...

View Full Version : How to window.close() and prevent the confirm that comes up?



hotwheelharry
06-13-2008, 11:32 AM
Not sure where to put this but the general section should be okay.

say you have a link like

<a href="javascript: window.close()">Close</a>

when you click on it, the browser asks you if you want to let script allow the window to close.

Is there a way to prevent the confirm box from comming up, and just close it.

If there is a solution, is it the same for a parent window and for a child window (one that the parent creates)?

Philip M
06-13-2008, 02:09 PM
Not sure where to put this but the general section should be okay.

say you have a link like

<a href="javascript: window.close()">Close</a>

when you click on it, the browser asks you if you want to let script allow the window to close.

Is there a way to prevent the confirm box from comming up, and just close it.
If there is a solution, is it the same for a parent window and for a child window (one that the parent creates)?


No, this is a security featute which cannot be over-ridden.

hotwheelharry
06-13-2008, 03:14 PM
I've seen it done before, but only with the window that was created with a script. It's usually at the bottom of Terms of Use or Privacy Policy pop-ups.

So I know that's possible. Do you know how to do that?

Philip M
06-13-2008, 04:06 PM
You can guess that this topic has been dealt with before.

http://www.codingforums.com/showthread.php?t=88357

http://www.codingforums.com/showthread.php?t=19659

I think the method listed above does not work in IE6+.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum