Reload death

11 03 2015

I have found a cool (and kind of stupid) way to make a browser tab unresponsive, sometimes crash the whole browser and in some cases crash the entire OS

Just add this peace of code to your website and make the user reload or close the tab.

 window.onbeforeunload = function () {
   while (true) {
     console.log("AAAA");
   }
 }; 

A working example here.

My experience:

  • On Linux, Chrome handles it sort-of well, shows “kill page” after a while, sometimes (sometimes not)
  • However, with open developer console, it makes entire browser unresponsive and, in one case, it crashed entire OS and I had to hard-reboot it
  • Firefox crashes
  • Mac OS X seems to handle this sligthly better, but I have no way to test it thoroughly
  • I don’t have a Windows computer so I can’t try it on Win / IE

Reported to FFx bugzilla here and chrome tracker here.