Project Management

Tricks of the pop-up windows trade

Whether you think they're marketing marvels or sales slight-of-hand, more organizations are greeting Web site visitors with pared-down pop-up windows that lack toolbars, menu bars, and location menus. Learn how Web developers do it.


If you regularly surf the Web, you've probably been trapped in multiplying pop-up windows. Nothing is more annoying than having browser after browser open, taking you to sites that you did not intend to visit. It's happening more frequently, as Web masters create sites to generate income through referral hits.

One of the latest tricks is to use redirector sites to launch pages from a variety of free Web hosting providers. The pages then move to a new location the next day. These sites are the Internet's version of the "fly-by-night" salesman. The pop-up pages launched by these sites don't have toolbars, menu bars, or location menus, leaving the viewer feeling trapped.

So how do developers do it? They use a JavaScript routine that executes in the body onLoad, or the body unload event.

Here's a sample of code that produces these types of pop-up windows:
function PopUpAnnoyingWindow(Flag)
{ var NewPage = ""
 NewPage = "form1.html";
 ID = window.open(NewPage, "", "scrollbars=yes,
resizeable=yes, toolbar=no, menubar=no, location=no,
directories=no, width=800, height=600");
 return(false)
}


After "popping" into the site, viewers can't see where they have gone. Advanced users might attempt to look at the source code to see where the form data is going. But right-clicking in the window only loads an alert box message with a copyright notice.

Here's the code that's used to prevent the user from displaying the right-click menu.
// No right click
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer'
&& (event.button == 2 || event.button == 3)) {
alert("Copyright (c) 1999-2000 Annoying Online Marketing,
LLC. All Rights Reserved.");
return false;
}
return true;
}


Have your clients been asking for this kind of feature?
Although you may find them aggravating, there are many businesses that employ this type of pop-up window on their Web sites. Have you, as a Web developer, been asked to provide something like this for your clients? Tell us about it in a discussion below.

 

Editor's Picks