How do you force Chrome pages/tabs to crash using JavaScript?
JavascriptGoogle ChromeGoogle Chrome-ExtensionJavascript Problem Overview
Trying to set window.location
or using window.navigate()
to make the browser go to about:crash
or chrome://crash
doesn't work. Is there a way to do it?
Javascript Solutions
Solution 1 - Javascript
FUN FUN LOOP:
txt = "a"; while(1){ txt = txt += "a"; //add as much as the browser can handle } //[evil laugh] BOOM! All memory used up, and it is now CRASHED!
http://jsfiddle.net/DerekL/M45Cn/1/
> Sorry for the Chinese characters...
Extra
Fun Fun Loop also works on Firefox!
And I have to give an applause to Safari, because it automatically reload the page when it is about to crash! Good job Webkit developers!
Oh yeah...
WARNING: Don't try it in Internet Explorer... Because it crashed not my browser, instead, it crashed my Windows 7... Yes. I have to restart the computer after that thing.
Solution 2 - Javascript
I realize this question is over a year old, but apparently you can use chrome://inducebrowsercrashforrealz
.
Here is a list of additional debug chrome://
URLs, taken from chrome://about
:
chrome://crash
chrome://kill
chrome://hang
chrome://shorthang
chrome://gpuclean
chrome://gpucrash
chrome://gpuhang
chrome://ppapiflashcrash
chrome://ppapiflashhang
chrome://restart
Solution 3 - Javascript
Simple enter the following line of code into the chrome address bar to see a Chrome tab crash simulation:
chrome://crash
Solution 4 - Javascript
This is by far the most simple way. Create an Array with the largest number possible for Arrays. This will not take up a computer's memory, but it will crash the page in a number of seconds.
[...Array(2**32-1)]
Let's say that your computer can handle this (it shouldn't). Try this to give your computer more stress:
[...Array(2**32-1)].map(_=>Math.ceil(Math.random()*111))
These can be called from the address bar with:
javascript:[...Array(2**32-1)]
or
javascript:[...Array(2**32-1)].map(_=>Math.ceil(Math.random()*111))
Solution 5 - Javascript
Found this on Reddit
Crashes an i5 8th Gen in a few seconds.
for (var i = 5; i > 3; i = i + 1)
{ console.log(i); }
<html>
<h1>This Should Crash Your Browser</h1>
</html>
Disclaimer
This will crash your StackOverflow Page in a few seconds if you run this code.