/ Published in: JavaScript
This snippet uses the <code>onbeforeunload</code> event to ask users whether they want to remain on the current page or navigate to a new URL.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script> window.onbeforeunload = function () { return "Type your text here"; }; </script>