Usually I open an new window / tab for links that go to an external url (i.e., an URL outside the website domain).
I do this because the website will then still be open, and when the user closes the new window/tab he is back on my website.
It’s still valid in HTML4 but that’s to be expected as the specification has not updated (now their working on HTML5)… now HTML5 says that it’s valid but emphasises it’s appropriate usage is for being used in conjunction with an iFrame (the target attribute), blank itself still exists however that’s one of the current failings in the HTML5 spec (with it’s blatant disrespect for accessibility). All versions of XHTML prohibit the use of target entirely for the very reasons it’s considered a bad practice.
PS: W3School’s hasn’t been updated in ages, it’s effectively an abandoned site and considered no longer suitable for a reference
IMPORTANT: W3Schools is not owned or operated by the W3C. It’s a third party website which has no relation to the World Wide Web Consortium.
I knew that. It’s not good for a current reference, but the information there is good, if sometimes a bit obsolete. Are you sure it’s been abandoned, or just neglected? (Update: I’ve poked around the site and learned it was maintained by someone called refnesdata.no, who is now quietly advertising the site as for sale. Abandoned seems the proper usage here.)
Ryan, I might be more interested in such links if they could open sites in new tabs, as opposed to new windows, but as far as I know, there’s no way to do that given current HTML specs and browser configurations. I know that in general, links that open automatically in new windows are considered usability no-nos. And besides, they p!ss me off.
Best practice and most accessible is to let your visitors decide. So neither of those options is really needed. All your visitors need do if they want a link to open in a new window or tab is to either configure their browser to do it automatically or to right click and select how they want it to open.
All adding either code does is to remove one or more of their choices.
That doesn’t mean that they should be forced to open a new window though. It is far better that they be educated on how their computer works so that they can choose when they want to open new windows than to have everyone forced to open new windows when asomeone else decides for them.
As a general rule, you should avoid opening links in new tabs/windows if at all possible. That has been the guidance for years, but with the increasing prevalence of tabbed browsers, it’s more important than ever. Some tabbed browsers open such links in new windows without giving the user the option to open them in new tabs (even though people are more likely to want to open the links in a new tab). Taking that level of control away from the user is not a good plan, because it irritates people, and irritated people don’t make good customers.
Most half-way competent surfers know they can right-click and “Open in new tab/window”, and can choose to do this as and when they want to open the link in a new tab or window. If they aren’t that clued up, the chances are they are likely to get confused by clicking on a link and then not being able to go back to the previous page.
The only time that you should open links in a new tab/window is when it would be damaging for people to navigate away from a page and then use the back button - eg a form or interactive feature that might lose any inputs the user has already made.
(Only the ~1% of surfers who are smart enough to use Opera can choose to override the page and open a link in the current tab/window even if the code says it should open in a new one - hurrah for Opera!)
Best practices and usability will give you the same answer - things are considered to be best practices because they work best for people using your site, not for any other reason.
IMO the deciding factor is whether you wish your visitor to usefully stay with a tab/window open on the prime site - while diverting to the new link. It is amazing (seemingly) how few folks seem to know how to use their back button etc.
A good example can be - a page with a selection of external links - and you want visitors to be able to go thru the list one at a time perhaps - thus by keeping their original tab/window available they do not have to keep back buttoning. If more folks used and knew about “open new window/tab” there would not be a problem.
The ‘target’ attribute (when applied to an anchor) can be used in any (x)html Transitional document and typically is supposed to be associated with a Frameset hence why is has never been deprecated for Transitional documents.
Essentially the TARGET attribute is used with frames to specify in which frame the link should be rendered obviously you can have target on more elements than the anchor; _blank renders the link in a new, unnamed window.
Though obviously you are supposed to use scripts if you want to spawn a new window not related to a frame and that is why Strict doesn’t use it.
The HTML 3.2 tags that were deleted from HTML 4 are the ones that are in the transitional doctype and labelled as deprecated. Those are the ones that you are supposed to be replacing as you transition from using HTML 3.2 to using HTML 4. Once you finish transitioning to HTML 4 you can then use the HTML 4 strict doctype.
The Frameset didn’t even occur in HTML 3.2 and as for HTML 4.01 the ‘target’ is not Deprecated or it would have been listed as such because you cannot even have ‘target’ on an HTML 3.2 Anchor in the first place.
Though I know what you are getting at; APPLET, BASEFONT, CENTER, DIR, FONT, ISINDEX, MENU, S, STRIKE, and U (all deprecated). I agree in the sense that is the objective though.