how to close a javascript window when asp script end

Discussion in 'ASP General' started by Navin, Aug 6, 2003.

  1. Navin

    Navin Guest

    i open the file download.asp from another main.asp page using
    window.open
    what the problem is when i clikc on the hyperlink it prompts me the
    ie save dialog box
    taht fine.
    but when the script ends in download.asp i wanna close the
    download.asp .asp window open in background..
    but that not working.
    how to close the window download.asp as i wanna save the content in
    text format i dont wnat to use the body unload event handler as the
    html tags will be printed in the text file
    guys give yr inputs i am stuick in this..




    function downloadWIN( windowURL ) {
    return window.open( windowURL,'download',
    'width=10,scrollbars=0,height=10,toolbar=0,location=0,directories=0,status=0,menuBar=0,screenX=50,screenY=50,left=50,top=50'
    ) }

    <td ><a href="#" onclick="javascript:downloadWIN( "download.asp")">
    >download sample</font></a>

    </td>
    </tr>



    here my file download.asp

    <%
    dim StrFileName
    StrFileName="a.txt"
    Response.ContentType = "text/plain" 'Content Type For File Download
    in Csv Format
    Response.AddHeader "content-disposition","attachment; filename=" &
    StrFileName 'Prompt the user For File Download
    Response.Buffer=true
    Response.Write "hi"
    %>
    <script>
    self.close()
    </script>
     
    Navin, Aug 6, 2003
    #1
    1. Advertising

  2. Navin

    Ray at Guest

    If you're forcing a download, why are you doing a window.open?

    Ray at work

    "Navin" <> wrote in message
    news:...
    > i open the file download.asp from another main.asp page using
    > window.open
    > what the problem is when i clikc on the hyperlink it prompts me the
    >
    >
    >
    >
    > function downloadWIN( windowURL ) {
    > return window.open( windowURL,'download',
    >

    'width=10,scrollbars=0,height=10,toolbar=0,location=0,directories=0,status=0
    ,menuBar=0,screenX=50,screenY=50,left=50,top=50'
    > ) }
    >
    > <td ><a href="#" onclick="javascript:downloadWIN( "download.asp")">
    > >download sample</font></a>

    > </td>
    > </tr>
    >
    >
    >
    > here my file download.asp
    >
    > <%
    > dim StrFileName
    > StrFileName="a.txt"
    > Response.ContentType = "text/plain" 'Content Type For File Download
    > in Csv Format
    > Response.AddHeader "content-disposition","attachment; filename=" &
    > StrFileName 'Prompt the user For File Download
    > Response.Buffer=true
    > Response.Write "hi"
    > %>
    > <script>
    > self.close()
    > </script>
     
    Ray at, Aug 6, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    8,839
    sateeshranga
    Aug 7, 2008
  2. Iñaki Baz Castillo
    Replies:
    7
    Views:
    869
    Iñaki Baz Castillo
    Jan 12, 2010
  3. Walter Beierdonck

    Self.close() window without the dialog close?Yes/NO

    Walter Beierdonck, Apr 29, 2004, in forum: Javascript
    Replies:
    1
    Views:
    347
    Grant Wagner
    Apr 30, 2004
  4. Replies:
    3
    Views:
    411
    Chung Leong
    Jan 16, 2005
  5. Shang Wenbin

    close current window using window.close()

    Shang Wenbin, Sep 1, 2005, in forum: Javascript
    Replies:
    10
    Views:
    378
    Gérard Talbot
    Sep 2, 2005
Loading...

Share This Page