javascript - onbeforeunload in IE 10 -


i have problem:

i opening new window javascript:

var w = window.open( 'some url' ); 

and want catch event when window close. use onbeforeunload :

w.onbeforeunload  =  function(){ //some code } 

also tried jquery:

$(w).bind('beforeunload' , function(){  //some code }); 

but event handlers doesn't work in ie 10. can advise me issue?

use $(window) instead of $(w)

$(window).bind('beforeunload', function () {             return 'blahblah!';         }); 

works fine in ie10!

if in same domain try this:

var x = window.open('myurl'); x.document.write("<script type='text/javascript'>window.onbeforeunload  = function({return 'test';}</script>"); 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -