Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-13-2008, 11:32 AM   PM User | #1
hotwheelharry
Regular Coder

 
Join Date: Jun 2008
Posts: 102
Thanks: 6
Thanked 9 Times in 9 Posts
hotwheelharry is an unknown quantity at this point
How to window.close() and prevent the confirm that comes up?

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)?
hotwheelharry is offline   Reply With Quote
Old 06-13-2008, 02:09 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by hotwheelharry View Post
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.
Philip M is offline   Reply With Quote
Old 06-13-2008, 03:14 PM   PM User | #3
hotwheelharry
Regular Coder

 
Join Date: Jun 2008
Posts: 102
Thanks: 6
Thanked 9 Times in 9 Posts
hotwheelharry is an unknown quantity at this point
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?
hotwheelharry is offline   Reply With Quote
Old 06-13-2008, 04:06 PM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,103
Thanks: 197
Thanked 2,421 Times in 2,399 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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+.

Last edited by Philip M; 06-13-2008 at 04:17 PM..
Philip M is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:53 AM.


Advertisement
Log in to turn off these ads.