Created 12/2001

onunload + = evil

I was asked recently how the sites that that open windows when you close them do it? And the answer is that the authors of those sites have no hearts or brains. Well, actually, they do it by using the onunload event handler and the open() method of the window object.

It's a noxious combination.

Spend some time with the following demonstration, won't you?

  1. Open your text editor (Notepad or emacs or SimpleText)
  2. Select and copy the source cde below
  3. Save the document as onunload.htm
  4. Load it into a browser
  5. Experience the pleasure

After a while of playing whack-a-mole with the windows you will understand that opening windows onunload is a nasty idea. Leave it for the porn sites. With great power comes great responsibility, Kal-El.

Source Code:

	<title> and onunload used together are evil</title>
<body onunload="'onunload.htm')">

<h1>Wow, this is annoying.</h1>