Discussion Locked

What's wrong with my code

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi everyone... I need help.

Is there a way for the message "The Web page you are viewing wants to close the window. Do you want to close the window?" not to show up when clicking on the link?

Here is my code:

test

Close This Window

Thank You in advance!!

5 replies

by dklippert

Here's what I've found on the forums:

"You cannot close a browser window without the alert message.
This is for security reasons.

This alert only appears on the main browser window. If it is a second open browser window or popup etc, you won't get the alert message.

There is no other way to overcome this.

http://jibbering.com/faq/#FAQ4_14

You must have the user's permission to close windows you didn't open."

by jacmari

Thank you for helping me understand what was going on. I couldn't understand why my code wasn't working. You really cleared things up for me. Thanks a million!

by jay eckles

I've only experienced this message with Internet Explorer. The previous poster's response was correct. You cannot close the main browser window without getting the user's permission. If you launch this code in a child window, however, then the user generally will not see the message.

Here's a link to a really comprehensive Javascript FAQ. For this question you'd want to look in the "windows" section:
http://developer.irt.org/script/script.htm

Good luck.

Jay Eckles
www.jayeckles.com

This discussion is closed to new replies.