Answers for "javascript beforeunload"

1

js before unload

window.addEventListener('beforeunload', (event) => {
  // Cancel the event as stated by the standard.
  event.preventDefault();
  // Chrome requires returnValue to be set.
  event.returnValue = '';
});
Posted by: Guest on July-16-2020
0

javascript beforeunload

window.addEventListener("beforeunload", function(event) { ... });
window.onbeforeunload = function(event) { ... };
Posted by: Guest on March-22-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language