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.
我有一个 YUI 应用程序。在某些情况下,我想在用户关闭窗口之前提醒他。因此我捕获窗口关闭事件并执行
onWindowClose: function(e) { if (...) { YAHOO.util.Event.preventDefault(e); } }
浏览器显示一条标准消息:“您确定要离开此页面吗?按 OK 继续,取消停留在当前页面”。
如何自定义浏览器显示的消息?
检查 onbeforeunload 事件和我的答案
用户关闭 IE 时显示消息框
和
ASP.NET:更改数据关闭窗口时发出警告
它可能对你有用。