Created
March 13, 2013 10:05
-
-
Save creinig/5150747 to your computer and use it in GitHub Desktop.
HTML page that renders the browser unresponsive by blocking in a javascript function
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
<html> | |
<head> | |
<script type="text/javascript"> | |
function burn(seconds) { | |
var start = (new Date()).getTime(); | |
while(true) { | |
var now = (new Date()).getTime(); | |
var duration = now - start; | |
if(duration > (seconds * 1000)) { | |
break; | |
} | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<p>Burn for:</p> | |
<ul> | |
<li><a href="#" onclick="burn(2)">2 seconds</a></li> | |
<li><a href="#" onclick="burn(5)">5 seconds</a></li> | |
<li><a href="#" onclick="burn(10)">10 seconds</a></li> | |
<li><a href="#" onclick="burn(30)">30 seconds</a></li> | |
</ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment