How to close the browser down ?

  • Thread starter Thread starter Deasun
  • Start date Start date
D

Deasun

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
 
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.
 
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
 
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.
 
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
 
Back
Top