Is there a way to determine that the browser window was closed?

前端 未结 8 438
感动是毒
感动是毒 2021-01-14 12:35

How is it possible to identify that the browser\'s close button was clicked?

8条回答
  •  甜味超标
    2021-01-14 13:15

    would this :

    $(window).unload( function () { alert("Bye now!"); } );
    

    help you ?

    It is in jQuery though.

    you should check the link given by Demoli though, it has further information about this particular method ( and its downside ).

    edit : added link.

提交回复
热议问题