Last active
March 4, 2024 07:27
-
-
Save mbparvezme/bd6e620447915d28b29c389fff59e76b to your computer and use it in GitHub Desktop.
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
var warnings = ["First warning!! Do not try to leave or close the window.", "Last warning!! Do not try to leave or close the window.", "Sorry!! Your account locked."]; | |
var i = 0; | |
window.addEventListener("mouseout", function(e) { | |
if (!e.relatedTarget || e.relatedTarget.nodeName == "HTML") { | |
i++; | |
if (i <= 3) { | |
alert(warnings[i - 1]); | |
if (i == 3) { | |
window.location.replace("http://example.com/lock-window"); | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment