window.onbeforeunload = () => false; Object.defineProperty(window, "onbeforeunload", { get: () => null, set() {} });