javascript - onbeforeunload or beforeunload not working in Firefox -


i trying update seek time when going away current page. code working fine in chrome in firefox not working.

here code far (which working fine in chrome)

var myevent = window.attachevent || window.addeventlistener; var chkevent = window.attachevent ? 'onbeforeunload' : 'beforeunload'; /// make ie7, ie8 compitable  myevent(chkevent, function(e) { // >=ie7, chrome, firefox     var playerstate = jwplayer("myplayer").getstate();     if(playerstate == "playing") {         playerpaused();         return null;     } });   function playerpaused() {     var seek_time = jwplayer("myplayer").getposition();      $.ajax({         url: "posting_url",         type: "post",         data: {video_id : video_id, seek_time : seek_time},         datatype: "json",         beforesend: function () {          },         success: function (data) {             console.log(data.success);         },         error: function (request, status, error) {             console.log(error);         },         complete: function () {          }     }); } 

in firefox of time going error. not firing error.

i need achieve without prompting default message. working fine. need achieve in genuine way. using code working fine. not need show alert.

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


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -