为什么onbeforeunload()事件在关闭浏览器的时候,有时候会被触发,有时候不会被触发?用的还是Chrome浏览器。
window.onbeforeunload = function (e) {
e = e || window.event;
if (e) {
e.returnValue = '关闭提示';
}
return '关闭提示';
};
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
认证0级讲师