You Said this Was Dangerous, Right?
Well, it could be. Any time you let someone else run a program on your computer, there exists the potential for disaster. The worst part about pops is their potential for even greater abuse or misuse. Let's look at another example that is almost identical to the first, but with two slight variations:
In this instance, we're spawning the child window on unload rather than on load. What does that mean? It means that when the browser window is closed, we have one last chance to execute a command before the window goes awaya parting shot, if you will. So let's say that you have four advertisements you want people to look at: 1.html, 2.html, 3.html, and 4.html, respectively. You could use the onUnload command to automatically open up a different advertisement each time one is closed. If you're unscrupulous enough, you could do this all day long.
But let's go a little further, and pretend that you have only one ad, and you don't care if you annoy people with ityou just want them to see it. Look at this example:
Instead of calling a new browser window, this one calls itself back every time you close it. It's now become the advertisement that won't die.
Our code becomes only slightly more complicated because now we must create a function and call that function, but we can use it to do terrible things:
So in this example, we created a function called "zing" that does nothing but spawn itself four times whenever a copy of it is closed. Even worse would be calling up four copies of itself on load. Any computer accessing this page would then begin spawning copies of itself until it ran out of memorygrinding to a halt in some sort of Star Trek death.