How to close the browser down ?

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
 
K

Kevin Spencer

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.
 
D

Deasun O'Donnachadha

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
 
K

Kevin Spencer

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.
 
D

Deasun O'Donnachadha

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top