Skip to content

Instantly share code, notes, and snippets.

@marekkalnik
Created July 30, 2012 21:31
Show Gist options
  • Save marekkalnik/3210450 to your computer and use it in GitHub Desktop.
Save marekkalnik/3210450 to your computer and use it in GitHub Desktop.
Kind window.unload popup
/**
* This won't work in newer FF versions as it doesn't handle onbeforeunload properly.
* Need another browser oriented hack...
*/
window.onbeforeunload = function (e) {
var newwindow;
e = e || window.event;
newwindow=window.open('http://www.google.com','cool-popup','height=800,width=800');
newwindow.focus();
if (e)
{
e.returnValue = 'Would you like to open our super-cool popup?';
}
return 'Would you like to open our super-cool popup?';
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment