JSFiddle - React, Tailwind, and code Playground
by Felis Catus
JavaScript
window.addEventListener("beforeunload", function (event) {
// Cancel the event as stated by the standard.
document.querySelector('body').setAttribute('style', 'background: red;');
event.preventDefault();
// Chrome requires returnValue to be set.
event.returnValue = 'Delete operation in progress; navigating away will result in some entities not being deleted';
return "please nooooo";
});