Use JQuery or onbeforeunload for IE and FF

混江龙づ霸主 提交于 2019-12-01 03:14:10

Try:

<script>
    $(window).on('beforeunload', function(){
        return "This should create a pop-up";
    });
</script>

Example: http://jsfiddle.net/AeztA/3/

neokjo

Would like to add that i figured out that you can't use an empty string in firefox. It has to be at least 1 blank for example as return.

var text = 'Exit Message';

$(window).on('beforeunload', function(){
    return " " + text;
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!