Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以更改 window.onbeforeunload 事件的默认选项(如果用户只是按 Enter 键)?弹出按钮默认为“离开此页面”(至少在 Chrome 中),我想知道在函数中是否有办法将此默认值更改为“留在页面上”。
如果不更改用户的 Web 浏览器本身,则无法更改退出对话框中默认选择的按钮。