Ask for confirm when closing a tab [closed]
You need to listen on the beforeunload event. Here’s a kickoff example: window.onbeforeunload = function() { return “Hey, you’re leaving the site. Bye!”; }; This message will show up in kind of a confirmation dialogue. This message will show up right before the client unloads the page. That can be a browser close, but that … Read more