Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Escaping an infinite loop without terminating the browser

Is there a way to escape a loop like the one below without closing the browser by terminating it process?

WARNING: Don't run the code below. Running this code will throw your browser in an infinite loop of alerts.

<html><body onload="while(true)alert('Hello')"></body></html>
like image 605
Babiker Avatar asked Sep 03 '25 04:09

Babiker


1 Answers

Some browsers will disallow this from happening in the first place.

Whenever this does happens to me, I do my best to do the following key sequence quickly:

[ENTER] Ctrl+W

Which will escape the loop and close the window/tab, but shouldn't terminate the browser.

EDIT I shouldn't say it escapes the loop. It closes the window which prevents that page from executing any more javascript.

like image 68
Jamie Wong Avatar answered Sep 04 '25 19:09

Jamie Wong