JavaScript
Article

jQuery Capture Close of Popup Window

By Sam Deering

jQuery code snippet to Capture the Close of a Popup Window.

//monitor the closing of a popup window
var win = window.open("http://dev.com/index.php?m=social&a=testLinkedIn",'','height=500,width=500');
var winTimer = window.setInterval(function()
{
    if (win.closed !== false)
    {
        // !== is required for compatibility with Opera
        window.clearInterval(winTimer);
        log('win closed...');
    }
}, 200);

No Reader comments

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.