Opening New Browser Windows
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.
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.
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.
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):
Note that the proper target is
NOTE: If you do use target attributes to open new windows,
be sure not to use them in links which normally open extra windows
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.
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.
This page was first created 29 Jul 1999, and was last modified 10 Oct 2010.