如何使用 JavaScript 强制 Chrome 页面/标签崩溃?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10965987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you force Chrome pages/tabs to crash using JavaScript?
提问by trusktr
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?
试图设置window.location
或使用window.navigate()
使浏览器转到about:crash
或chrome://crash
不起作用。有没有办法做到这一点?
回答by u283863
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/
http://jsfiddle.net/DerekL/M45Cn/1/
Sorry for the Chinese characters...
对不起,汉字...
Extra
额外的
Fun Fun Loop also works on Firefox!
Fun Fun Loop 也适用于 Firefox!
And I have to give an applause to Safari, because it automaticallyreload the page when it is about to crash! Good job Webkit developers!
我不得不为 Safari 鼓掌,因为它会在即将崩溃时自动重新加载页面!Webkit 开发人员干得好!
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.
警告:不要在 Internet Explorer 中尝试它......因为它不是我的浏览器崩溃,而是它使我的 Windows 7 崩溃......
是的。那件事之后我必须重新启动计算机。
回答by nyuszika7h
I realize this question is over a year old, but apparentlyyou can use chrome://inducebrowsercrashforrealz
.
我意识到这个问题已经有一年多了,但显然你可以使用chrome://inducebrowsercrashforrealz
.
Here is a list of additional debug chrome://
URLs, taken from chrome://about
:
以下是其他调试chrome://
URL的列表,取自chrome://about
:
chrome://crash
chrome://kill
chrome://hang
chrome://shorthang
chrome://gpuclean
chrome://gpucrash
chrome://gpuhang
chrome://ppapiflashcrash
chrome://ppapiflashhang
chrome://restart
回答by Danio
Simple enter the following line of code into the chrome address bar to see a Chrome tab crash simulation:
简单的在chrome地址栏中输入下面这行代码,就可以看到一个Chrome选项卡崩溃模拟:
chrome://crash