Ever notice that some Web sites just have a way of getting in your face? Yep, I'm talking about sites that cause other browser windows to mysteriously appear as you navigate to or from a page. And often, these surprise windows display nothing more useful than online advertising. This functionality, commonly referred to as pop-up windows, is usually achieved by script on a page calling the window.open method. (For details. see open Method.) Though its use can be irritating, when used properly, the window.open method can also allow for extremely powerful applications to be built.
The Internet Explorer team frequently receives requests to allow users to disable the appearance of pop-up windows. Yet this puts us in a dilemma: Do we allow developers the freedom to use this potentially powerful tool to offer great solutions to their customers? Or do we restrict the platform so developers cannot misuse this functionality? The Internet Explorer team has taken the stand that except where security concerns are present, we should allow developers as much flexibility as possible to build powerful applications, without undue restrictions.
This month I'd like to discuss why the pop-up window functionality is necessary. I'd also like to recommend a few practices that should help keep visitors on your site-or at the very least, keep them from leaving out of irritation.
Necessary Pop-Ups
The ability to show other windows so users may view related content without losing context is extremely useful and is well utilized in many places on the Web. Often, the user is hardly aware that another window is utilized, as it appears a natural extension of the task they are trying to achieve.
An example of good use of the window.open functionality is MSDN's online references for Internet Explorer. Open up the Web page, onblur Event in your browser. If you scroll down, you'll see some sample code and a 'Show Me' button so you can see the sample code in action. When you click this button, the sample is shown running in isolation in a new window. This is highly useful in this circumstance, as the context is maintained for the user, who can see both the sample and the reference page at the same time.
Were browsers to restrict the window.open functionality, a great many sites on the Web today would be broken. While we might not mind breaking some sites that just create pop-up advertisements, there are many sites that make legitimate use of this functionality.
Worst Practice
Let's look at what I think is the most obscene usage of this functionality, and I use the word obscene here deliberately, for it tends to happen on the most obscene sites. I call it 'trapping the user'; whenever you click on a link to another page, or attempt close the browser window, some script on the page traps the event and proceeds to open yet another browser window. This technique seems to be used most often on porn sites.
This practice can be most irritating, especially when you stumble into the site accidentally through an inadvertent search on the Web, only to find that you suddenly have five or six windows open with obscene images in them-and every time you try and close one of them, another two appear! Not only is this irritating, it can also be extremely offensive, and the innocent user may feel the only way to escape the endless stream of images is to use the reset button on the computer.
Of course the sites that do this are after eyeballs to help pay advertising revenue, and as such, are unlikely to follow the recommendations I make about best use of this functionality. Nevertheless, I'll make a heartfelt plea that such sites refrain from trapping the user, and also rate their content appropriately (see the article, Internet Ratings) so that users can set their browser to avoid it.
Best Practice
The following is an outline of what I consider to be best practices with regard to this technology. Ultimately the choice is yours how to use this functionality, but keep in mind that if you misuse it, visitors to your site are likely to become irritated and therefore less apt to return.
1.Think about the audience for your site. Do they actually understand the concept of multiple windows?
The readers of this column no doubt understand how to have multiple applications running at the same time, and how to switch between them. Consider, however, the less experienced computer user, for whom managing multiple windows may seem an overwhelming task. If you expect inexperienced users to frequent your site, it may well be appropriate to offer the entire user interface to your site in a single window, so that users do not lose context and get lost switching from one window to another.
2.Only open a new window in direct response to a user action, and think about how to make it clear to the user that their action will open a separate window.
In my view, one of the most irritating things for any computer program to do is to open a new window without the user having initiated an action If you use window.open only in direct response to a user action, then the user will associate the action with the result. If there is a long delay between a user action and a result, then the user will struggle to make an association between the two.
3.Do not use a pop-up only to display an advertisement.
An advertisement is unlikely to get a user's positive attention if it is not part of the primary site they are visiting.
4.Do not trap visitors in your site.
It may be appropriate to prompt a user when they are leaving your site to see if they wish to save some state. Trapping them by opening another window, however, is simply rude, and will hardly entice the user to return.
Use Dynamic HTML to Avoid the Use of Pop-Up Windows
Dynamic HTML is extremely powerful and allows you to build flexible applications. A few years ago, the entire Web was static; every time you clicked on a link, an entirely new page was ent by the server back to the user. Then Java, plug-ins, and ActiveX Controls were used to allow users greater interactivity, yet these failed to integrate well with the HTML content of the page. With the emergence of Dynamic content support in Internet Explorer 4.0, and the subsequent enhancements to this functionality in version 5.0, 5.5, and now the 6.0 preview, there is a much richer set of functionality available.
This rich functionality allows you to offer solutions where all user interface takes place in a single browser window, and users feel they are operating a full application. One of my favorite examples of this is at blox.com. This company offers online spreadsheet and presentation software that runs in the Internet Explorer browser without any additional components being installed. Due to the power of this solution, it does require that Internet Explorer be used to visit the site and run the applications. Yet it demonstrates the kind of rich Web experience that can be achieved without the use of irritating extra windows.
One technique that can be used to provide separate content as part of a page is "inline frame," often known as IFrames because of the
Annoying and Intrusive Sites
0 comments
Hide comments