[removed] in Chrome: what is the most recent fix?

后端 未结 4 1636
伪装坚强ぢ
伪装坚强ぢ 2020-11-29 06:05

Obviously, window.onbeforeunload has encountered its fair share of problems with Chrome as I\'ve seen from all the problems I\'ve encountered. What\'s the most recent work a

4条回答
  •  一向
    一向 (楼主)
    2020-11-29 06:38

    Here's a more straightforward approach.

    $(window).on('beforeunload', function() {
        return "You should keep this page open.";
    });
    

    The returned message can be anything you want, including the empty string if you have nothing to add to the message that Chrome already shows. The result looks like this:

    enter image description here

提交回复
热议问题