Anne van Kesteren

Links in new windows (target="blank") considered harmful

Yesterday and the day before yesterday I mailed with Phil Moore about new links in a standard compliant world. According to the author of that article it is all about validators (at least, he is hiding markup with Javascript to make the document validate). Here is the important part:

anchor.target = "_blank";

The TARGET attribute is deprecated. There is a theoretical possibility that a browser only supports the HTML 4.01 Strict specification and therefore does not support TARGET. That same browser might support some other Javascript functionality, like window.open to actually open links or other things in new windows. However, I don't want to recommend that. The much weirder part is of course that you are using Javascript to insert attributes, because your document wouldn't validate as HTML 4.01 Strict otherwise. Plain wrong.

Opening a link a new window is evil. Read Day 16: Not opening new windows to understand why. Reading the first two points in the The Top Ten New Mistakes of Web Design (from 1999) might also give you an idea.

My argument made earlier about the TARGET being deprecated doesn't make much sense of course. Eventually, we will use it again for the OBJECT element in XHTML documents when some patch is applied.

Comments

  1. I hate it when clicking on a link opens a new window; however, when a client tells me that they want that behavior, I have no choice but to implement it. Since it is a behavior, it seems that JavaScript is appropriate to achieve it.

    Posted by Simon Jessey at

  2. Javascript is indeed appropriate, but not using the method described in the referenced article. Because in that case you are still relying on HTML, in the end. However, using the "HTML method" is more compatible than the Javascript method will ever be.

    By the way, I tend to go into a little discussion with the client when they ask for such specific behavior and mostly, I can convince for not doing it for reasons mentioned above. There are not that many clients who think they know better than various usability and accessibility experts.

    Posted by Anne at

  3. just to round dampen the "don't ever use pop-ups because of accessibility" angle: if we look at WAI WCAG 1.0 checkpoint 10.1:

    10.1 Until user agents allow users to turn off spawned windows, do not cause pop-ups or other windows to appear and do not change the current window without informing the user. [Priority 2]

    there are few (very few) cases in which it's useful to spawn a new window - mostly in web applications, but yes, resorting to javascript hiding methods just to get the "valid xhtml" boyscout badge is missing the point completely

    Posted by patrick h. lauke at

  4. Personally, I don't make a habit of having a new window open up at all. In addition to it being annoying, I wouldn't consider it a good user experience to someone who is, say, visually impaired.

    I could also go on about a certain Priority 2 check point in the W3C's Web Content Accessibility Guidelines, but I'm sure everyone is (hopefully) aware.

    Posted by crazybat at

  5. I actually do not agree on the whole open in new window bash. From a communication view of point its very (very) bad to leave the origional page to go to an external other webpage, not being of the same company. Even when you give the user a big fat warning, because user do not read. Next to having the user think the webpage is of the same company/owner, surfing the other website might even make the user forget about your site, the site he came from, also because no visual clue to remember you is around anymore. You also trust on the user to actually know the use of the back button. If they don't know they have absolutely no reference back to your page.

    In fact opening a new website (in a new window) is the start of a new browsersession on that particular webpage. The working of the backbutton isn't broken at all, because on the first window it still works as expected. It is also the way the web has worked for years and to wich most users have allready adapted. Using a tabbed browser is a good way to keep the taskbar from becoming cluttered, but of course this is something the user should be able to decide for itself as in mozilla.

    Posted by Jurriaan at

  6. There are not that many clients who think they know better than various usability and accessibility experts.

    I so, so wish that was the case down here! ;-)

    Posted by Charl van Niekerk at

  7. Jurriaan, in most cases it's very obvious if a link referes to an external site or not. So one can decide for himself to open it in a new window/tab or not.

    Offcourse it also depends on the targetgroup and the purpose of the document.

    Posted by Jerome at

  8. Jurriaan, while it is an interesting point of view, the back button is the button everyone is comfortable with. I think it is the very first button you learn to use. If you click somewhere and don't like the result your mouse automatically goes to that button (or you use a keyboard shortcut; depends on your level of experience and what you are comfortable with).

    I have heard by the way that breaking the back button is a browser user interface problem. However, since every browser in existence handles it the very way the back button behaves right now it would be quite bad to blame the browser and not yourself.

    Posted by Anne at

  9. Thankfully, Firefox has extensions to get round this. If you don't want the bloat that is TBE, I reccommend Single Window.

    Posted by David House at

  10. I use target="_blank" in only two places on my personal site, and I think both are valid. I use it to pop up a help window explaining my personal version of Textile/Markdown/wiki-markup, and I use it to pop up a feedback page with a text area and a send button so people can send me bug reports quickly and easily. Both of these operations are clearly marked on my site -- the Principle of Lease Surprise is important in web dev as in all software. I think they're reasonable and I don't consider either to be evil.

    Automatically using the feature just because you want to demonstrate that the user is now leaving your site, however... that's evil!

    Posted by Eric TF Bat at

  11. Ok, now you've got me thinking again.

    Sometimes I ponder whether something like target="_newtab", would be a great idea of not.

    Then I find myself wondering... wouldn't it be a perfect world if there was something in my browser preferences where I could make all new windows actually open in a new tab instead, just so I don't have to right click on links for safety sake? (and an extension just won't do, 'cause this should really not be something left to users who already know how to right click a link and why)

    I hate links that open in new windows. Personally, I think tabs are more accessible since you can still easily see each tab, unlike a window that covers another window. Of course you can still look at the task bar to see your window title's, but when I was a new user, that confused the heck out of me. I've seen under average net users grasp the concept of tabs really easy.

    So I'm begging the question... do you think tabs are better than windows? Or are tabs as evil or worse?

    Posted by Devon at

  12. Jurriaan, in most cases it's very obvious if a link referes to an external site or not. So one can decide for himself to open it in a new window/tab or not.

    It may be clear, the user still leaves ur site, maybe not to return. If another window still holds ur website, that chance is a lot bigger.

    Aother problem is that, while the backbutton maybe known to most users, the shift-use or rightbutton popupmenu (different for every browser and even browserversions) however is not. So a lot of user don't realise they have a choice.

    Offcourse it also depends on the targetgroup and the purpose of the document.

    This of course is true as in almost any discussion

    Jurriaan, while it is an interesting point of view, the back button is the button everyone is comfortable with. I think it is the very first button you learn to use.

    Again the way to open a new window may very well not be known. And the backbutton isn't really broken. The external site just isn't there, just as you would loose it by using your back-button and than navigating to a different page.

    Automatically using the feature just because you want to demonstrate that the user is now leaving your site, however... that's evil!

    Why is it evil? We are not talking about unwanted popups or anything, but about a page a user has requested. I can imagine a commercial company not wanting their visitors to leave. And since they do make up a large part of the website population, the target (or window would be even better in a frameless world) attribute should be there as a could-use attribute. I can see how people want an 'override target attribute' in their browser though.

    There a lot of backdrops to using the backbutton too. Flash content would have to be reloaded every time the site is revisited. Same thing for POST data. If the original page is behind in line to some page with POST data, a lot of user will be scared off by the unfriendly 'the page could not be loaded message'. Javascript variables are lost in both firefox and IE (Opera does this right btw.) with the possibility of dangerously crippling ur site if the user does suspect to his changes to still be there (like a javascript store application where no serverside option is available). Also filled in formdata is not always there anymore when u use the back button. Still it would be pretty usefull to be able to use links to give the user some (additional) help on a page with forms.

    Actually a good example of why I personally don't like it is Anne's website. In the articles there are a lot of links, many of them to external blogs or websites. My personal way of navigation, probably not used by me alone, is to open each link in a new page, read the article, maybe some other info, close down that window and continue reading the article on Anne's page. Even the stackorder of the windows works like keeping the crumps to where u have been. Now I noticed 2 situations. Both where i forgot that the links were not opened in a new window. The first time I read the information on the external page, and like I was used to closed down the window. Gone are original page and the browser history alltogether. Talk about usability (Am I also the only one pressing alt-f4 in another application, by accident closing down the browser window... same effect). Now the second time the external link was very very interesting. And it had even more interesting links to other sites, wich I followed, never to return to the article. I forgot about the whole existence of the article until the next visit.

    Posted by Jurriaan at

  13. So I'm begging the question... do you think tabs are better than windows? Or are tabs as evil or worse?

    I think tabs are a whole lot better, because it actually gives a visual clue that a new window has opened (a new tab appears). Using a browser fullscreen with no tabs, this might not be as clear to the user, and indeed feel like the backbutton is broken, allthough the original page will always be waiting in the background for the user to return to.

    Posted by Jurriaan at

  14. I highly prefer that if websites must force links to open in new windows they use the target method for one very simple reason: killing target with proxomitron is far easier than killing window opening javascript.

    Posted by Thomas at

  15. Awesome. So u r telling me that popups wont work. Happy! Happy!

    Posted by Randy Charles Morin at

  16. Actually a good example of why I personally don't like it is Anne's website. In the articles there are a lot of links, many of them to external blogs or websites.
    Juriaan.

    There are many issues at hand here but the key to this is user choice. A user should have the right to decide how their browsing experience should pan out. Just because you wish to let the user keep your website open doesn't automatically follow that they wish to.

    I disagree with this whole uneducated user angle. If a driver causes a crash because he/she was driving in the right-hand lane (UK). Do we say its ok because they didn't know their Highway Code (UK driving document indicating legal requirements) well enough? People should be reading software documentation. I care not for people who say they haven't the time to learn. That's preposterous. People who don't read documentation, warnings with their medication, or small-print on a contract, are simply ignorant and/or asking for trouble.

    We should be catering for users who know how to operate their software and hardware. I'm not saying that we should ignore the needs of the uneducated but rather not force personal standards upon people to ensure repeat business.

    I am interested by your point about external links on Anne's posts. In my browser I find Command+Left click opens a link in a new tab. There are options for many browsers to make new windows and tabs open through key/mouse combinations, By reading documentation, people will discover these things. I also know when a link is external because the address appears in my status bar. I believe it appears in a tooltip in Opera for Windows.

    Posted by Paul Connolley at

  17. I'd like to echo Mr. Connolley's opinion: it's all about user choice. Employing no special target, you leave the user a choice of either following the hyperlink within the context of their current history progression, or start a new history progression.

    If you force a target, there is no choice, and it's quite difficult for a user to get that choice back. It's certainly magnitudes more difficult than learning how to create new windows/documents/tabs/etc via your agent's UI.

    Posted by J. King at

  18. If you'll indulge me, Anne, I'd also like to supplement something else Paul said:

    I also know when a link is external because the address appears in my status bar. I believe it appears in a tooltip in Opera for Windows.

    URI and title do indeed appear in a tooltip (which can be turned off) in Opera. I think it's worth noting, also, that's it's not hard for an author to note "external" resources without forcing any particular behaviour. All it takes is some good, descriptive title text. If you use a title like "David Baron: 'Intranet mode?'", it should be apparent if not obvious that the resource the hyperlink points to is not a part of Anne's Web log.

    If you get into a habit of writing title text for every hyperlink that isn't entirely self-descriptive (ie. just about anything that isn't site navigation), then you can not only denote external resources, but also give the user a bit of an idea as to what is waiting for them.

    Posted by J. King at

  19. Anne, I thought the same thing when I first read that article. My blog wasn't up and running then, or I would have written about this very topic. The article is targeted (pun intended) towards validation and completely misses the point: accessibility.

    Whether to open a link in the same window, a new window or a new tab should be my choice.

    A usability study made by IBM actually showed that opening external sites in new windows increased the likelihood of non-power users getting lost. When a new, maximised window overlay the previous one, they thought the link had opened in the same window. And then, of course, the back button didn't work.

    Anyone who thinks they need to force their visitors to stay on their site should focus on writing more interesting copy rather than spawning windows left and right. If it happens to me, I usually think, pathetic buggers and close the now extraneous original window with a sigh.

    Posted by Tommy Olsson at

  20. I find, have always found the deprecation of target="_blank" absolutely ridiculous.

    Posted by Daniel Glazman at

  21. Comment 3: perhaps the most important part there is the first part:

    10.1 Until user agents allow users to turn off spawned windows, do not cause pop-ups or other windows to appear and do not change the current window without informing the user. [Priority 2]

    In other words, pop-up windows are okay really!

    The first time I read the information on the external page, and like I was used to closed down the window. Gone are original page and the browser history alltogether. Talk about usability

    You need Opera. Any closed window can be re-opened at any time from the Window menu. What's more, it retains its history! So you can go back to each previous page you were on.

    (Opera is also useful for filling in these comments as you can set up the required tags as notes, then just right-click to insert them. No more typing blockquotes!)

    Posted by Chris Hester at

  22. There are some instances when a new window, or at least some form of pop-up, is absolutely useful. They almost always involve some form of user help. For example, a pop-up glossary of terms.

    Posted by Simon Jessey at

  23. There are some instances when a new window, or at least some form of pop-up, is absolutely useful. They almost always involve some form of user help. For example, a pop-up glossary of terms.

    Of course. Many a time have I seen the Terms and Conditions link on a page and I have wanted to keep my current window available. That is why I choose to open it in a new window. Once again it is user choice. If you wish to recommend that a user open it in a new window then place a sentence with the link so that they understand.

    Posted by Paul Connolley at

  24. Personally I don't think that the fact that the target attribute is deprecated implies or stresses that opening new windows is a bad thing. But if you do really feal like opening a new window, you'll need to find another way. I, too, think it should be up to the user, but the attribute itself and accassibility reasons are two different things. A target clearly doesn't say anything meaningful about the link, nor would I like a "_tab" value or anything like that, since it would imply that the markup expects the user's client to support tabs...

    The first comment here mentioned that opening new windows is behavior, and hence script should be used to do it. Whether you do that by adding a target anyway, or by hooking it up to a rel attribute is up to you, but I chose the latter. I don't make my site open external links in new windows, mind you, but I do feel that the script demos and images should appear in a centered popup.

    This was to be the default behavior. (accomplished with rel attributes and 1 document onclick event) But since the user should be able to choose something else, I included an exception for clicks with ctrl or shift held down, so that a user might choose to open the link in a new window, or tab, and not a popup.

    Personally I think that this is quite an elegant solution ;) the href contains the link, there is only a rel attribute and no targets or individual onclicks, and the user may choose to let it behave in another way. I have to admit that I don't think of that as too harmful... :)

    Posted by Peter at