Using onbeforeunload without dialog?

前端 未结 5 681
死守一世寂寞
死守一世寂寞 2020-12-09 16:04

I\'m trying to post data when a user leaves my page. I have finally managed to find a working solution, however, it shows a confirmation dialog when the user leaves. I have

5条回答
  •  伪装坚强ぢ
    2020-12-09 16:48

    If you want to disable the dialog, please only write

    window.onbeforeunload = function() { ... return; }

    instead of

    window.onbeforeunload = function() { ... return ''; }.

    I hope it will help you.

提交回复
热议问题