//可阻止页面刷新、跳转、关闭
window.onbeforeunload = function(event){
event=event||window.event;
event.returnValue="确定要离开当前页面?";
};
//而window.onunload不会阻止页面刷新、跳转或关闭,只是在走前留下一句话
//可阻止页面刷新、跳转、关闭
window.onbeforeunload = function(event){
event=event||window.event;
event.returnValue="确定要离开当前页面?";
};
//而window.onunload不会阻止页面刷新、跳转或关闭,只是在走前留下一句话
转载于:https://www.cnblogs.com/frostbelt/archive/2012/08/17/2643815.html