Last active
July 9, 2019 04:22
-
-
Save y-temp4/58eb5930dbf83f5178bdd1a911cd074f to your computer and use it in GitHub Desktop.
window.onbeforeunload の変更を検知して「このサイトを離れますか?」のポップアップを表示しないようにする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperty(window, 'onbeforeunload', { | |
set(newValue) { | |
if (typeof newValue === 'function') window.onbeforeunload = null; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment