SPS Home    >   Dgreath    >   JavaScript Code Library    >   Window Close

JAVASCRIPT CODE TO CLOSE WINDOWS

The following script will close open windows without bringing up the "The page is trying to close the window" warning box. In a nutshell, it creates a reference the current window as if it were opened in script, then closes that window.

Another version is shown which will work directly embedded in markup.
JS Code for Head Container


  

JS Code for Body Container


  

Browser Test

This button tests that this script works with a given browser:

If this page closes, the code is compatible with this browser.