【发布时间】:2019-09-13 17:48:13
【问题描述】:
我在我的 js 代码中添加了beforeunload,如下所示,它适用于 IE10
我想给用户一个警告,别无其他
$(document).ready(function () {
init();
window.addEventListener("beforeunload", function () {
if (changeSubmitted) {
return 'If you choose to leave, the data entered will not be saved!';
}
return true;
});
});
但是,该事件似乎没有在 Edge 中触发。
【问题讨论】:
标签: javascript microsoft-edge onbeforeunload