user198989
user198989

Reputation: 4665

Open popup onbeforeunload

I want to open pop-up on exit (Not "stay on page or leave" box). I can't get this working. Where do I make mistake ?

 function poponload()
{
testwindow = window.open("http://www.google.com", "mywindow",     
"location=1,status=1,scrollbars=1,width=5,height=5,left=100,top=100");
}

$(document).ready(function () {

window.onbeforeunload = function () { 

poponload();

});


$(window).unload(function () {

poponload();

});


});    

Upvotes: 0

Views: 1119

Answers (1)

Ryan Lynch
Ryan Lynch

Reputation: 7776

Your code has a syntax error. You have an extraneous parenthesis after the onbeforeunload function assignment. Remove it and see if that fixes your issue.

window.onbeforeunload = function () { 

poponload();

};

Upvotes: 1

Related Questions