How to close the browser down ?

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default How to close the browser down ?

    Good evening all.
    I know how to close the browser down when there is no
    frames involved.
    I have a frameset aspx page. It has 3 frames, left, main
    and bottom.
    In the left frame I have a exit button. I want the user
    to be able to click on it and then the browser closes.

    Anyone know how this can be done?
    Also is there anyway other then using java code to kill
    the browser on a button click?

    Thanks
    Deasun
    Deasun Guest

  2. Similar Questions and Discussions

    1. SESSION and browser close
      I have written a shopping cart application which kills all SESSION vars when the browser is closed. However, despite it working correctly on my...
    2. close all browser windows?
      Does anyone know of any javascript or other method to close all open browser windows? I have an issue where a user logs in to our intranet through...
    3. Close Browser and Change URL - HELP!
      Hi all, Here's my situation: I have a URL with a link that: 1. Opens a new browser window, in which reside an SWF movie. 2. At the end of...
    4. close my project that is in a browser window (close this window)
      How can I do this with a button? What do I have to put into button?
    5. Browser Close Event
      which event is fired when a browser is closed. i want to call asp page which deleet some files on the server. i tired using onunload event but it...
  3. #2

    Default Re: How to close the browser down ?

    Try this javascript:
    parent.window.close();

    --
    I hope this helps,
    Steve C. Orr, MCSD
    [url]http://Steve.Orr.net[/url]


    "Deasun" <tirnaog@mail.com> wrote in message
    news:09d701c34fc5$112b0710$a001280a@phx.gbl...
    > Good evening all.
    > I know how to close the browser down when there is no
    > frames involved.
    > I have a frameset aspx page. It has 3 frames, left, main
    > and bottom.
    > In the left frame I have a exit button. I want the user
    > to be able to click on it and then the browser closes.
    >
    > Anyone know how this can be done?
    > Also is there anyway other then using java code to kill
    > the browser on a button click?
    >
    > Thanks
    > Deasun

    Steve C. Orr, MCSD Guest

  4. #3

    Default Re: How to close the browser down ?

    You may need to do this (slight modification because the parent was not
    opened by another window):

    parent.opener = parent;
    parent.close();
    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    [url]http://www.takempis.com[/url]
    Big things are made up of
    lots of little things.

    "Steve C. Orr, MCSD" <Steve@Orr.net> wrote in message
    news:u0BEj78TDHA.2648@TK2MSFTNGP10.phx.gbl...
    > Try this javascript:
    > parent.window.close();
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD
    > [url]http://Steve.Orr.net[/url]
    >
    >
    > "Deasun" <tirnaog@mail.com> wrote in message
    > news:09d701c34fc5$112b0710$a001280a@phx.gbl...
    > > Good evening all.
    > > I know how to close the browser down when there is no
    > > frames involved.
    > > I have a frameset aspx page. It has 3 frames, left, main
    > > and bottom.
    > > In the left frame I have a exit button. I want the user
    > > to be able to click on it and then the browser closes.
    > >
    > > Anyone know how this can be done?
    > > Also is there anyway other then using java code to kill
    > > the browser on a button click?
    > >
    > > Thanks
    > > Deasun
    >
    >

    Kevin Spencer Guest

  5. #4

    Default Re: How to close the browser down ?



    Thanks for the help. I put the following under my btn click event:
    Response.Write("<script>parent.opener =
    parent;parent.close();</script>")

    Didn't work. Tried your first example too. No help.
    Any other ideas ?

    Thanks

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Deasun O'Donnachadha Guest

  6. #5

    Default Re: How to close the browser down ?

    Using Response.Write is dodgy at best. Try defining the script as a string,
    and using RegisterStartupScript() to add it to the page. Also, which page
    are you adding this to? It would have to be a page in a frame, not the
    frameset itself.
    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    [url]http://www.takempis.com[/url]
    Big things are made up of
    lots of little things.

    "Deasun O'Donnachadha" <tirnaog@mail.com> wrote in message
    news:ednKhnEUDHA.2252@TK2MSFTNGP12.phx.gbl...
    >
    >
    > Thanks for the help. I put the following under my btn click event:
    > Response.Write("<script>parent.opener =
    > parent;parent.close();</script>")
    >
    > Didn't work. Tried your first example too. No help.
    > Any other ideas ?
    >
    > Thanks
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Kevin Spencer Guest

  7. #6

    Default Re: How to close the browser down ?

    Well tried that I did.
    Didn't work. Here is what I have;
    Note! I tried the following in both Page_Load and Page_Init

    Dim scriptString As String = "<script>parent.opener" scriptString =
    scriptString & "parent;parent.close"
    scriptString = scriptString & "();</script>"
    If (Not Me.IsStartupScriptRegistered("Do_CloseApp")) Then
    Me.RegisterStartupScript("Do_CloseApp", scriptString)
    End If

    And under the btn click:
    Response.Write("<script>Do_CloseApp();</script>")

    That i am not sure is correct. Please let me know if that is the correct
    way to call the script.

    What did it do:
    The browser appears and then disappears by itself. No error msgs.

    Thanks for the help with this.
    Deasun

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Deasun O'Donnachadha Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139