如何从退出弹出窗口中删除对话框

How to remove dialogue box from the exit popup window?

本文关键字:窗口 删除 对话框 退出      更新时间:2023-09-26

我想在关闭浏览器之前显示一个弹出的winodw。这是我的代码。我使用了以下插件

http://kbeezie.com/cross-browser-exit-pop/

这是演示 http://kbeezie.com/exitpop.html

<script type="text/javascript">
function PopIt() { 
    $("a#trigger").trigger('click');
    window.onbeforeunload = UnPopIt;
    return "Would you like to join our mailing list for other offers?"; 
}
function UnPopIt()  { /* nothing to return */ } 
$(document).ready(function() {
    window.onbeforeunload = PopIt;
    $("a#trigger").fancybox({
        'hideOnContentClick': false,
        'showCloseButton': false
    });
    $("a[id!=trigger]").click(function(){ window.onbeforeunload = UnPopIt; });
});

但是在显示弹出窗口之前,此代码会显示一个"您想加入我们的邮件列表以获取其他优惠吗?"问题。我想删除该弹出问题,并仅在此处显示该弹出窗口。

由于OP的评论而编辑

不能使用自定义的卸载前模式。这是您无法绕过的安全措施。

原答案

只需将显示return "Would you like to join our mailing list for other offers?";的行更改为return "Your message goes here within the string";