javascript on window close event

后端 未结 1 1801
长情又很酷
长情又很酷 2021-02-20 01:26

I am currently detecting if a user of my site closes the window/tab or changes the url.

I am using the follwoing code, which works perfectly:

var validNa         


        
1条回答
  •  青春惊慌失措
    2021-02-20 01:54

    The window close event is fired as the very last event. Therefore no other events are fired after it.

    You can use the beforeunload event with Jquery, to show the overlay on screen.

    The following link could help: link

    0 讨论(0)
提交回复
热议问题