592   jQuery JS

1,页面刷新,关闭,跳转前,尚未发出请求,先执行beforeunload,

2,请求完成,获得新内容,将要加载到页面前,执行unload

3,例子如下

 

jQuery(document).ready(function ($) {
$(window).bind(‘beforeunload’,function(){
console.log(“beforeunload”);

});
$(window).unload(function(){
console.log(“unload”);

});




Leave a Reply

Your email address will not be published. Required fields are marked *