I hate the
target attribute! Sure, it has it’s place in HTML, but it has been abused by so many people, it is just annoying. There isn’t really any specific twit for this blog, it’s more of a general overview of the excessively annoying habbit that many authors have.
Why is it Bad?
It’s bad because it attempts to force the user to open a new window. It should be obvious to many people with the excitement over tabbed browsing that allows a user to manage all pages in a single window, that multiple windows are disliked.
Basically, the author of a website should not have any control over the users application, in any way whatsoever. It has been known for long time that opening new windows confuses users. Not only that, it affects users in the following ways:
- A user has to close the window, or at least switch windows, to get back to where they were.
- The back button does not work, including the back button some people, like myself, have on their mouse. That means instead of just holding my hand still and operating my back and forward buttons with my thumb, I have to move my hand to the close button (or use a keyboard shortcut) which takes time. For me, back and foward buttons on the mouse are as essential as the scroll wheel, so when website breaks them, I get annoyed.
- It clutters the desktop and taskbar. I like to keep no more than 5 (or sometimes 6) windows open on my desktop at one time. This includes e-mail, calendar, browser, development environment (text editor, IDE, or whatever I'm using) and sometimes a Windows Explorer window for quick access to my files. If there are any more than that, the buttons on the task bar become too small, there’s too many windows on the desktop and therefore it takes longer to decide which which window I want and where it is located.
Despite these facts, why do people continue to use this user-hostile act? I don’t really understand it, but some think, as Nielsen mentions, that people will remain on their site longer. At least, that’s how my boss tried to explain why the
target attribute, unfortunately, must be used for external links at work. Well, this is a myth, not only because (as Nielsen also mentions) the user cannot return in the normal way, but because they’re not looking at your site anyway. They have a new window in front of it, so any reason to open the new window is defeated since any extra time the browser window spends on your site, is spent elsewhere by the user.
Thankfully, there is a solution to this epidemic. There are extensions, such as the Single Window extension that traps links that would open a new window, but instead opens a new tab. However, I still don’t think that’s right either — I should be the one to decide when a new tab opens. There is also a preference in Mozilla called
browser.block.target_new_window which causes any link with a target attribute that is not targetting an existing window or frame, to open in the same window/tab. It is also possible to use a user stylesheet to give some indication when an author is the using the target attibute. I find Chris Pederick’s userContent.css to be the most effective for this purpose. Even though I like to use the browser preference and the user stylesheet (I didn’t particularly like Single Window myself), it’s not a perfect solution and the idea that people think they have the right to control my user agent still bugs me.
There are still some links that always open a new window, unless I explicitly drag the link to the tab bar to open it in an existing or new tab, as desired. These kind of links annoyingly occur in Gmail. Any external link in an e-mail, and even some internal links to different sections of Gmail, try to unconditionally force a new window. These links use a combination of the
So, in conclusion, It’s my window and I’ll open it if I want to! Please do not force a new window, and please encourage others to drop this bad habbit also.