我有这段代码:
function stopNavigate() {
$(window).off('beforeunload');
}
$(window).on('beforeunload', function() {
return 'Are you sure you want to leave?';
});
$(window).on('unload', function() {
$.ajax( domain + '/poneOffline' );
);
它在Chrome中运行良好,但在Firefox中,并非用户关闭浏览器时。有谁知道为什么会这样?