Cancelable: The beforeunload event can be canceled by user interaction: // by window. addEventListener(“beforeunload”, function(event) { event. preventDefault(); // Cancel the event as stated by the standard.
How do I cancel Onbeforeunload?
Cancelable: The beforeunload event can be canceled by user interaction: // by window. addEventListener(“beforeunload”, function(event) { event. preventDefault(); // Cancel the event as stated by the standard.
How do I disable Windows Onbeforeunload?
3 Answers. window. onbeforeunload = null; This will simply unbind the function from the event.