Sinisterly
Simple javascript script to crash browsers - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: Simple javascript script to crash browsers (/Thread-Simple-javascript-script-to-crash-browsers)



Simple javascript script to crash browsers - Greece - 01-27-2016

Code:
var total = ""; for( var i = 0; i < 100000; i++ ) { total = total + i.toString(); history.pushState(0,0, total ); }

I think a lot of people know about this already, but it's pretty crazy how simple but deadly this is. I'm surprised major browsers like Chrome haven't done anything to prevent this yet. This basically saves the current page state (each state request is around 1mb I think) then that x100000 is equal to like 25ish gbs of ram the pages uses up. I'd think Chrome would block an individual tab from using this much ram but apparently not. This won't cause any major damage but it definitely will lag/crash your browser if you keep it open for too long.

This code also has the ability to crash iPhones (sort of like the effective power glitch) and reboot.

[Image: Dr3vg9K.png]


RE: Simple javascript script to crash browsers - Bish0pQ - 01-27-2016

Didn't see it before, but if you think about the code it's pretty obvious that the browser would crash. Nice share though.