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

后端 未结 4 1632
伪装坚强ぢ
伪装坚强ぢ 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:36

    Answer:

    $(window).on('beforeunload', function() {
        var x =logout();
        return x;
    });
    function logout(){
            jQuery.ajax({
            });
            return 1+3;
    }
    

    A little mix and match, but it worked for me. The 1+3 makes sure that the logout function is being called (you'll see 4 if it's successful on the popup when you try to leave).

提交回复
热议问题