Net Twits

2004-10-12

Don’t Target Me!

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.

Solution

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 target attribute and a JavaScript function in the onclick event handler. Disabling JavaScript is not an option in this situation because doing so completely destroys all other functionality in Gmail. I’ve known about this for a long time and have been plainning to give Gmail a Net Twit award. But there is just so much to write about and so little time, so this will have to come at some time in the future (Hopefully) if I ever get around to writing it.

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.

Comments:

Anonymous said:

A nice interoperable way, too, is to use a proxy to rewrite the target to "_top". It's not as handy as Mozilla's setting, but it does the trck for agents that don't have such settings (such as IE). I remember seeing something like Mozilla's settings somewhere in Opera's main INI file. Maybe I should have a look see how it works...

-- J. King

Comment Posted: 10:38 AM

Lachlan Hunt said:

The problem with using a proxy to rewrite the target attribute is that it does have legitimate uses as a frame target. So, it really needs to be handled by the browser when it can determine whether or not that frame target actually exists, which cannot be done by a proxy.

Comment Posted: 2:54 PM

Anonymous said:

Agreed. Unfortunately, few workarounds are ever perfect.

-- J

Comment Posted: 1:06 PM

Abdul Bijur V.A. said:

/me is impressed by your blog and the whole bunch of css tricks on your site.

bravo!

avallark
http://bijur.de

Comment Posted: 4:34 AM

Anonymous said:

If you find the browser.block.target_new_window not working in Firefox 1.0, it's now changed to browser.tabs.showSingleWindowModePrefsThen go to Tools > Options > Advanced > Tabbed Browsing, check the Force links that open new windows to open in:

Comment Posted: 1:46 PM

Foxtyke said:

Well, I for one agree... in fact because I agree, I have made a suggestion to the developers of my blog host to help remedy the situation...

My msg to the devs

Comment Posted: 8:52 PM

Anonymous said:

I like the target attribute.

Back and forward are all very well, but are notorious for causing issues when viewing pages that result from POST data.

If I login to my email, then go to another website that someone sent me a link to, I don't want to have to re-enter my username and password to go back and read the next message, nor do I want to have to resubmit the form data.

Okay, I could just Shift-Click the link - make the decision myself - but why should I have to when it makes far more sense for the system to do it automatically?

I believe that any link that takes you from a "logged in" scenario to an external page should open in a new window - so I will support the right of all developers to save me time and use the target atribute!

Comment Posted: 7:24 PM

trojjer said:

I'm not sure about this one. I think that the "open in new tab" option might be better in some circumstances, in tabbed browsers like my now quite cherished Firefox (well, except when it allows people to use window.open() in Javascript with those bloody window display properties set, so that the tab-bar gets hidden and you have to right click just to get rid of any new page that's annoyingly opened in the same window, but on a different, unselectable tag! Which is another thing to mention, that I think is worse... I might check Bugzilla about it).

I know you said you were against this approach, but I have a reason: it would save me the extra hassle of having to go to that good old right click context menu, and selecting "Open link in new tab". That is what I tend to do anyway, when having an off-topic external site or page open in the current tab, I think, would throw me off my personal way of backtracking through various URLs.

Right now I have about ten different tabs open in Firefox, for example. This concept is rather new to me, lol, and perhaps it's a bit too much for me to properly attempt to digest; but when I'm doing nothing other than browsing (usually when I should be sleeping; it's after 4am *sigh*) for an extended bout of time, it seems to serve me well. I flick through my accumulated train of thought, without having to use the back button at all – I feel that having the tab-bar emulating the drop-down panel of such a button is quicker and more instantaneous to use, and it preserves the state of each page without having to reload them individually. [Edit: Having read the last Anonymous post now, I agree with the argument for the preservation of POST data, as such, for example.]

I bet I'm not alone in this way of browsing, of course; for me it's one of the best ways of using those tabs (although, true, I obviously like to start from scratch in a clean tab when I type in a URL manually, like most people, unless I'm finished with a particular page). I either close a tabbed page when I'm done with it, or load up something else into it, as I said; I don't think about the Back button at all for these occasions.

Because of this, I often don't actually want a link to open in the same window if it's in a particularly long article – although then again, I suppose, it might be better just to finish reading something first before following any link! But, you're right in that new windows opening all the time does get annoying – it's just that I often want them to open in a new tab for me instead, which would save the desktop clutter.

I also don't see a problem if it's based on an explicit user preference. But that tends to rely on extra JS code just to open a window, which I think is a bit unnecessary, sometimes, when target="_blank" has been there for years, and requires no additional backend (I know what you're thinking, and I bet that Sitepoint article [too lazy to link properly] interests you – although I wonder if the target property of an anchor element's DOM reference will stick around for long... Although, I suppose, it is "separate from the markup layer", and all that, therefore it probably will; despite the slightly ambiguous history it has in tandem with the deprecated HTML attribute). Although it does “degrade” almost transparently I suppose, so there's nothing really to worry about – it's just a shame that this seems like the only way to obey a possible preference for users of all browsers, regardless of scriping-ability, and yet still remain Compliant (it could be done on the serverside when the markup is parsed, for those who aren't so bothered about the occasional "accepted norm", lowest-common-denominator type methods [being that no JS or anything is required]).

Hang on... Having said all this crap, I've had a slight change of heart. I think that people should be able to choose their preference, true; but for the sake of those rich sods using PDAs and mobile phones and such-like*, and smaller screens everywhere, it should be disabled initially, in addition to how external links should always be clearly flagged as such.

Phew. It's two hours since I started this... Maybe it's time I stopped opening so many tabs simultaneously, damnit. Oh well. Sorry about the lengthy read. :P

* No offence meant to anyone really; but I own a Sony Ericsson T610 and a Nokia 3510i – WAP/GPRS “oldies” like those handsets should be part of an Basic Acid Test for Mobile Devices... If a page can display on them, it should be awarded somewhat! :D Although, then again, with CSS that isn't a hard task, because they're so outdated already that they don't even attempt to render anything other than plain old HTML. No Opera Mini for me, grr. I wish it could understand basic character references and entities though – it's laughable. And frustrating.

PS: Hmm, why does Blogger replace my perfectly acceptable – entities with slim hyphens??? Argh! I hate it when I spend ages manually editing certain special characters in posts (I'm addicted to using “ and ” for quotes, now, too; although ' seems like too much hassle for me, especially when people incorrectly set their parsers to turn single quotes into “apostrophes”. And I tend to draw the line with that one anyway, from a “Leave me alone, I'm writing!” standpoint.)

PPS: Oh, so that's what the straightened quotation marks in the textarea represent; the actual UTF-8 characters... I thought it'd replaced my hand-edited directional quote entities with a lesser model pair! :D

Comment Posted: 3:53 PM

trojjer said:

I don't get it - it won't let me escape entities! I typed ' for example, and it literally ends up as an apostrophe... *sigh*

Comment Posted: 4:05 PM

trojjer said:

Ah, wait. I need to double-escape, lol... What I actually meant to type, in the last post at least, was ' - well I'm glad I got that over with!

Comment Posted: 4:07 PM

Anonymous said:

Still not right! But bugger it, I'll leave now before you get even more sick of me, ahem.

(Double spacing is tricky -- especially when, in order to show what you actually typed, it needs to be triply-escaped at first!

Comment Posted: 4:13 PM

trojjer said:

Hehe, I think my comments are longer in total than the article itself... :'D

Comment Posted: 7:55 AM

Post a comment | Home

Blogger

This WeBlog is a gallery of websites that basically, just get it wrong! The aim is to showcase the stupidity of some of the worst HTML-Terrorists. It's not just about the millions of average website builders who use image-text navigational links, tables for layout, or nothing but <font> tags. This blog aims to point out those who take that little extra step in making their site difficult to use, completely inaccessable, totally annoying or just hypocritical!

Net Twits Atom Feed

Other Resources

  • Unicode Encoded
  • Creative Commons License
  • [an error occurred while processing this directive]
  • [an error occurred while processing this directive]
  • Powered by Blogger