Can JavaScript Close This Window?
Tuesday August 26, 2008
JavaScript can tell whether the current page is in a window opened by JavaScript
JavaScript can only close windows (and tabs) that were opened by JavaScript. If the window or tab was already open before your visitor got to your site then there is nothing you can do to close it - if you try then IE will pop up an alert telling your visitor that you are trying to close their browser while other browsers will just completely ignore the request. You can get more consistent treatment between browsers if you test for yourself whether the close is allowed before attempting it - that way you don't annoy your IE visitors with that alert.
Can JavaScript Close This Window?


Comments
No comments yet. Leave a Comment