I have a form that when filled in, I can exit the window without being given a warning (I'm using Chrome).
How can I ensure I get a warning before exiting? Is there a Django setting for this?
You need to supply a function returning a string to onbeforeunload
of the window or the document body in order to trigger the "Leave site" popup.
window.onbeforeunload = () => '';
<a href="http://example.com">Click to trigger</a>
The event is called beforeunload, so you can assign a function to window.onbeforeunload
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With