Dan's Web Tips | New Browser Windows

Dan's Web Tips:

Opening New Browser Windows

[<== Previous] | [Up] | [Next ==>]

See also Macedonean translation and Bosnian translation (done by others in their own sites)

In a minute, I'll show you how to make links open up new browser windows, if that's what you really want. But first I'll try to talk you out of it.

When you link somewhere, just go there!

TIP: Don't annoy your users by forcing extra windows to open, or leaving them in your frameset even after they follow a link away from your site.

It's a growing, annoying trend in the Web these days for links to external sites not to take you there unconditionally (as Web links always have in the past), but rather put the new site within a frame, or pop up an additional browser window. I've even seen sites that pop up an additional browser window that has the linked-to site in a frame... complete with an ad banner in another frame that stays there no matter where you surf on. All of these techniques have the presumptuous rationale that the user can't or won't decide on his own where he wants to surf to, whether he wants to return to the original site, and whether he wants to pull up additional Web browser windows to surf two sites at once. A "New Browser Window" command exists in most Web browser software; let the users do this if they want. You shouldn't force it on them. If the user is low on memory, the extra window can cause a system crash. As for frames, they're even worse; they take up big chunks of the screen, they keep the user from seeing the URL of the site he's surfed to, and if the destination site has frames too, the available screen space shrinks some more.

Another thing to note: A while back I tried surfing the Web on an Internet kiosk at an airport, set up by Get2Net, and found that whenever I tried a link on a site that tries to open up new browser windows (whether by simple targetted link or JavaScript), those links simply went nowhere. Something flashed on the screen too briefly to see, then the display returned to the page I was already on. Apparently the kiosk software has some automatic function to close any extra windows that the browser tries to open, or else send them into the background behind the main window (where no user function is provided to bring them back forward again). Thus, sites that open new browser windows are inaccessible on those kiosks, even if their links are to perfectly normal sites that would work fine if they didn't try to target the extra window.

So when you want to link somewhere, just link there... don't try to trick the user into keeping a piece of your site around. Make your site good enough so the user wants to come back even if you don't coerce him into doing so.

Update: The Mozilla browser now supports a configuration option to disable new window opening, alongside the option that's been there for a few months to disable pop-up windows. These features are, by themselves, a good reason to switch to using Mozilla. Unfortunately, this no-new-window feature is currently a "hidden" preference, hard to find and change, because having it prominently featured in the user interface was too confusing to people who found that this feature didn't stop all new windows -- there are a number of ways of creating them, including through JavaScript, and the preference setting only works for the simple "target" attribute method. (Opera also has configuration settings allowing the disabling of new windows, so it's another browser that's user-friendly rather than marketer-friendly!)

How to Do It, Anyway

Like most "annoying Web tricks" (such as frames and auto-refreshing pages), there are a few occasions where there's a reasonable use for opening up additional browser windows, such as in letting users bring up reference information to help them in filling out an online form (without the browser leaving the form and possibly losing the data the user has partially entered). For those occasions, here's how to do a new-window link. First, a simple targetted link that opens a new browser window (usually sized the same as the current one):

<A HREF="link.html" TARGET="_blank">

Note that the proper target is _blank, in all lower case. There are many mistaken impressions among Web authors of what the correct target is, aided and abetted by the fact that the popular browsers do in fact open up a new window when given any unrecognized target name, but the proper target according to the formal HTML specs is _blank (with an underscore as its first character).

NOTE: If you do use target attributes to open new windows, be sure not to use them in links which normally open extra windows already, like mailto: links, links to multimedia content like sound files which often launch external viewers, and links to data files which are normally downloaded and saved rather than viewed directly in the browser. When you add the _blank target to these sorts of links, it will make some browsers launch an extra, useless, browser window in addition to the normal new application window caused by the link itself. This extra browser window will probably contain the user's own configured home page, and he/she will be rather confused as to why this came up. (Be especially on alert if you add a target to a <BASE> tag to be used on all links in a page; you'll need to override it with TARGET="_self", which causes the link to target the same window it's already in, the normal default unless changed through a BASE tag.)

A more complex new-window link, using JavaScript to open a window of a specified size and gracefully degrading to a normal targetted link for non-JavaScript users, is:

<A HREF="link.html" onClick="popup = window.open('link.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">

Note that these JavaScript windows, which lack some of the normal controls of browser windows, are often considered even more annoying by users, though they may be acceptable for small reference lists being popped up to assist in filling out forms. If the user is likely to do any significant amount of "surfing" in this new window, then the absence of the "Back" button, URL and status fields, and other such controls will be a major annoyance.

Free Web Space may be worth what you paid for it!

TIP: Watch out for those free Web hosting services, which may annoy your site's users by popping up ad windows. For any serious Web site, it's probably worth it to pay a host site so you can avoid such impediments.

Sites like GeoCities and Tripod were really popular for a long time for hosting personal Web sites (but GeoCities is now defunct), and even some organization and company sites. (These days, however, social-networking sites like Facebook, and blogging sites, are now the trendy thing instead.) Site creators like those hosts because they can put Web sites up there for free. But you pay a price, even if not monetarily. Some of those free host sites have begun to pop up ad-banner windows every time a user enters the site. Many users find these things highly annoying. They can also sometimes cause browsers to crash, if the user is running low on memory already or has a system that is otherwise unstable. Because of these problems, some users avoid going to sites with geocities.com or tripod.com addresses altogether.

The user can avoid these pop-ups by disabling JavaScript, but this often causes poorly-designed sites to be un-navigable if the creator used script-based navigation controls with no alternative method of getting around. So many users keep JavaScript enabled, but curse at every site that pops up a silly advertising window. This doesn't put the user in the best frame of mind to appreciate your site. (However, the Mozilla browser now gives a configuration option to eliminate popups on page entry or exit without stopping other JavaScript. On the other hand, to date it still offers no configuration to ignore target attributes opening links in new windows, unfortunately.)

A common question on the Web-authoring newsgroups is how a Web author can contrive a site to suppress these pop-ups and other things inserted by the free services. While there are some tricks that will sometimes work, this is not a good idea. If you're using a free service to host your site, you're agreeing to their terms of service, which include displaying whatever ads they see fit to inflict on your users. Using trickery to suppress them is in effect cheating your provider out of its advertising (which is the price of the free service), and is thus dishonest. It may also get your free Web space terminated if the trickery is noticed.

Hence, it's a better idea to find an alternative place to put your site that doesn't use annoying popups in the first place. Maybe your ISP lets you have free Web space for personal home pages. Or it might be worth it to spend a few bucks getting Web space somewhere else.

By the way, it's not cheating anybody if the user suppresses the pop-ups through browser configurations, if possible. The browser user has no contract with GeoCities or Tripod, but the site developer does. So the user isn't violating anything if he sets his browser to ignore JavaScript code that pops up additional windows (but the site developer might be in violation, depending on the specifics of the agreement to host the site, if he actually provides a mechanism to disable that stuff).

Links

 

[<== Previous] | [Up] | [Next ==>]

 

This page was first created 29 Jul 1999, and was last modified 10 Oct 2010.
Copyright © 1997-2011 by Daniel R. Tobias. All rights reserved.

webmaster@webtips.dan.info