« Previous entry | Next entry » Browse > Bad code

Skip to comments (6) Hanging Firefox
Posted by Erik on Jan 04 2006 @ 11:10  :: 3166 unique visits

Just put this code in a page and press the Ok button 3 times very fast. On my machine firefox just hangs and does nothing.

CODE: HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <title>Crash FireFox</title>
  </head>
  <body>
    <script language="javascript" type="text/javascript"><!--
     document.onfocus = function() {
       alert('click me fast...');
     }
    //-->
</script>
  </body>
</html>


It has something to do with the onfocus because this way it doesn't work:
CODE: JAVASCRIPT
function test() {
  alert('click me fast...');
  test();
}
test();


This code is only very irritating because it won't let you close firefox, except with the taskmanager.

6 comments posted so far
Add your own »

1. On Jan 04 2006 @ 15:57 guest wrote:

If you turn off the javascript enable button in firefox, you could avoid being face with this malicous code.

2. On Jan 04 2006 @ 16:43 guest wrote:

It's pretty obvious why it happens: whenever you click 'ok' the alert dialogue loses focus and the document regains it - hence, 'onfocus' is called for the body element.  Rinse and repeat.

3. On Jan 04 2006 @ 17:33 Erik wrote:

that is right 2e guest only why doesn't it hang with the second script which also keeps on displaying the alert message box?

4. On Jan 06 2006 @ 20:39 guest wrote:

That's an interesting point.  I'm not sure!

5. On Mar 18 2009 @ 09:51 guess wrote:

Weaknesses of world of warcraft gold the client-server model used by World of Warcraft have been wow power levelingexploited in order to crash the cluster of servers that wow8goldmake up a realm. Exploits also include characters being able to instantly Cheapest Wow Goldchange location or teleport. The situation became worse when cheap wow goldtrying to coordinate activities across a number of players or guilds on the same realm.World of Warcraft Lead Producer, stated that new realms would be introduced to relieve warhammer gold the burden on existing ones. Existing realms would be upgraded.

Although the game wow gold follows a similar model to others in the genreand was noted for having wow gold cheap many familiar concepts from roleplaying games, the new approaches gold4powerto reduce pauses between game encounters was well liked. At various times, World of Warcraft players have experienced problems with connecting to and logging in to wow gold for salethe game. Sudden server crashes that would force realms offline also occurred.

Add a new comment

Name:
Password: (leave empty for anonymous comment)
 
View formatting tags Comment: