Created
April 6, 2022 15:34
-
-
Save ericoutinho/6fe68c97cadc3129f632ccbb1926a3dc to your computer and use it in GitHub Desktop.
Prevenir fechamento da aba do website
This file contains hidden or 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
| // Prevenir o fechamento da aba do website | |
| // com aviso do navegador | |
| window.addEventListener("beforeunload", event => { | |
| event.preventDefault(); | |
| event.returnValue = ''; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment