jquery - onbeforeunload issue in IE browser -
i using below code leaving current page. works fine in chrome , mozilla, calling every anchor tags in ie 10 browser. can prevent calling in ie 10 browser?
window.onbeforeunload = function() { return ""; };
this default behavior of ie, need remove onbeforeunload event anchor tag while hovering on it:
$(document).ready(function(){ //store onbeforeunload later use $(window).data('beforeunload',window.onbeforeunload); //remove||re-assign onbeforeunload on hover $('a') .hover( function(){window.onbeforeunload=null;}, function(){window.onbeforeunload=$(window).data('beforeunload');} ); });
or need 'return false' onclick event of each anchor tag:
<a onclick="somefunction(); return false;" href="lnk" >my link</a>
Comments
Post a Comment