I used the onbeforeunload
function to show a message when the browser or tab closes. It's working and a message shows once you close the page. The problem is that it is currently also showing up when the page is refreshed, and I only want to show this message on close. Is there anybody that has a solution for this problem?
No solution for this. A page is refresh and unload the DOM so the onbeforeunload
event will always be called.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.