If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > clsoe browser

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-11-03, 11:01
gleech gleech is offline
Registered User
 
Join Date: Dec 2002
Posts: 20
Red face clsoe browser

Dear All

Does anyone one know how to clsoe IE?

I'm using the onbeforeunload event which works fine but i don't want a dialog box to show, also I don't want the code to run when the backbutton is pressed, i only want the code to run when the (X) in the top right of the browser is clicked

This is what i'm using so far, a basic example
<SCRIPT>
function closeIt()
{
event.returnValue = "Are you sure you want to close the browser";
//event.returnValue = false;
}
</SCRIPT>
</HEAD>
<BODY onbeforeunload="closeIt()">
</BODY>
</HTML>

any help?
Reply With Quote
  #2 (permalink)  
Old 09-11-03, 12:32
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Re: clsoe browser

It's not ASP code, but JavaScript.

window.close();

But here's the problem, if you're closing a browser window the user opened, they will get a popup saying "This webpage is attempting to close your browser, do you want to?" (or along those lines) - this is a security feature. Now, if you create the window in JavaScript, you can close it without getting a popup box.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 09-14-03, 00:09
fused fused is offline
Registered User
 
Join Date: May 2003
Posts: 23
If you do not want the security prompt, do the following:

window.opener = null;
window.close();

Is this a flaw? I aint sure.

Last edited by fused; 09-14-03 at 00:12.
Reply With Quote
  #4 (permalink)  
Old 09-23-03, 04:19
Cos Cos is offline
Registered User
 
Join Date: Sep 2003
Posts: 6
Thumbs up

That's magic! Great! My answer was the same as seppuku's
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On