View Full Version : close the current window when opening a new popup

12-23-2005, 07:58 AM
How can I close the current window when opening a new popup window through onload method

Means i open a popup in full screen when a page loads, and i want that the original window which opens the popup will close automatically without any notice.

Plz Help

12-23-2005, 08:26 AM
via javascript, moving you there...

12-23-2005, 08:46 AM
You can simply use the window.close(); function to close the current window.

You have the popup in the onLoad, correct? Just add this to the function you are using to load the new popup:


Is that what you wanted?

12-23-2005, 09:04 AM
You can't close the parent window. IE will give you a confirmation saying a script is trying to close the window do you want to allow it etc. Firefox and other browsers simply won't allow it. You can only close the parent window if that window was opened with javascript.

12-23-2005, 10:38 PM
You are only allowed to close windows that you opened. If you open a new window then you can close it by calling the close method for that window. If you didb't open the window then you can't close it. Most browsers will either ignore the request or will ask if the person wants to allow you to close the window - many people will then reply NO since they are using that window to browse the web and intend to continue browsing after leaving your site.