YUI:自定义取消窗口关闭事件时浏览器显示的消息

发布于 2024-07-16 05:38:06 字数 291 浏览 5 评论 0原文

我有一个 YUI 应用程序。 在某些情况下,我想在用户关闭窗口之前提醒他。 因此,我捕获窗口关闭事件并执行

onWindowClose: function(e) {
        if (...)
        {
            YAHOO.util.Event.preventDefault(e);
        }
    }   

浏览器显示一条标准消息:“您确定要离开此页面吗?按确定继续,取消以留在当前页面”。

如何自定义浏览器显示的消息?

I have a YUI application.
Under certain circumstances I want to alert the user before he closes the window.
Therefore I capture the window close event and do

onWindowClose: function(e) {
        if (...)
        {
            YAHOO.util.Event.preventDefault(e);
        }
    }   

The browser shows a standrd message: "Are you sure you want to navigate away from this page? Press OK to continue, cancel to stay in the current page".

How can I customize the message the browser shows?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长梦不多时 2024-07-23 05:38:06

检查 onbeforeunload 事件和我的答案

显示消息框当用户关闭 IE

ASP.NET:更改时发出警告数据关闭窗口

它可能对你有用。

Check for onbeforeunload event and my answer in

show a message box when user close IE

and

ASP.NET: Warning on changed data closing windows

It may work for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文