你为什么要使用$(window).unload(function(){});超过$(window).bind('beforeunload', function(){});
像上面那样使用 jQuery 绑定 beforeunload 和像这样直接分配它之间有区别吗:window.onbeforeunload = function() { };
另请阅读: http: //www.quirksmode.org/js/events_events.html#link5
在使用“直接”方式(和attachEvent)之前,jQuery 将始终尝试使用addEventListener。addEventlistener 可以取消冒泡,并且可以附加多个回调。