Last active
December 18, 2022 03:46
-
-
Save kampar/5d6da959041f3b8e4c78 to your computer and use it in GitHub Desktop.
localStorage bomb to test your browser on how many characters your browser able to save
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> | |
<title>M. Jazman, Fuse</title> | |
<meta charset="utf-8"> | |
<script> | |
localStorage.setItem("fuse", "-"); | |
while(true) { | |
var fuse = localStorage.getItem("fuse"); | |
try { | |
localStorage.setItem("fuse", fuse + fuse); | |
} catch(e) { | |
alert("Your browser blew up at " + fuse.length + " with exception: " + e); | |
break; | |
} | |
} | |
localStorage.removeItem("fuse"); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
source was copied from
Freeman & Robson,
Head First HTML5 Programming
Chapter 9 p. 458
https://github.com/bethrobson/Head-First-HTML5/blob/master/chapter9/bomb.html