How to close the browser down ?

Discussion in 'ASP .Net' started by Deasun, Jul 21, 2003.

  1. Deasun

    Deasun Guest

    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, Jul 21, 2003
    #1
    1. Advertising

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

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


    "Deasun" <> wrote in message
    news:09d701c34fc5$112b0710$...
    > 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, Jul 21, 2003
    #2
    1. Advertising

  3. 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
    http://www.takempis.com
    Big things are made up of
    lots of little things.

    "Steve C. Orr, MCSD" <> wrote in message
    news:...
    > Try this javascript:
    > parent.window.close();
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD
    > http://Steve.Orr.net
    >
    >
    > "Deasun" <> wrote in message
    > news:09d701c34fc5$112b0710$...
    > > 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, Jul 21, 2003
    #3
  4. 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 http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Deasun O'Donnachadha, Jul 22, 2003
    #4
  5. 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
    http://www.takempis.com
    Big things are made up of
    lots of little things.

    "Deasun O'Donnachadha" <> wrote in message
    news:...
    >
    >
    > 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 http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Kevin Spencer, Jul 22, 2003
    #5
  6. 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 http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Deasun O'Donnachadha, Jul 23, 2003
    #6
    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. Denon
    Replies:
    1
    Views:
    582
    Saravana [MVP]
    Nov 14, 2003
  2. Daniel Albisser
    Replies:
    1
    Views:
    1,082
    GaryM
    Apr 7, 2004
  3. Ed
    Replies:
    8
    Views:
    5,631
    Pedro
    May 31, 2004
  4. Iñaki Baz Castillo
    Replies:
    7
    Views:
    873
    Iñaki Baz Castillo
    Jan 12, 2010
  5. Replies:
    0
    Views:
    503
Loading...

Share This Page