Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Deprecate target attribute in <a> tag

by herveus (Parson)
on Sep 16, 2005 at 17:35 UTC ( #492688=monkdiscuss: print w/replies, xml ) Need Help??

Howdy!

Perl Monks Approved HTML tags lists the target attribute as acceptable to use in an a tag. This allows someone to include a link that will automatically try to pop open a new window in your browser.

I'd like to see that no longer be the case. target=_blank is obnoxious, as it comes across as an attempt to usurp *my* control over *my* browser, frequently in the guise of "being helpful".

yours,
Michael

Replies are listed 'Best First'.
Re: Deprecate target attribute in <a> tag
by eric256 (Parson) on Sep 16, 2005 at 17:40 UTC

    Is there some rash of abuse of target I missed? Just curious since PM normaly takes the "If it aint borked, don't fix it" approach. Not that I agree or disagree realy, I like options but I can understand why some people might find targets annoying. On the other hand it seems like all good browsers let you over ride that stuff anyway. ;) I also wonder if a clever bit of CSS might completely solve your issue.


    ___________
    Eric Hodges

      It aint broken, so it should only be depreciated, not forbidden completely.

      That's still more than you should expect: the Q tags were forbidden completely (in both the CB and posts) just because some browsers (IE) don't handle it correctly. That's a devil's loop: if people don't use the Q tag, then browsers will never support it. (Also, does anyone know if this can be fixed at least partially with a CSS declaration?)

        This is clearly the devil's loop. If Perl monks don't produce target="_blank" links, then you and herveus will clearly never get off your duffs and fix your browsers to ignore target= (and perhaps browsers will never support such a configuration) and all of the other sites on the internet will continue to annoy you two by violently forcing you to open a new window against your will.
      Howdy!

      The specific motivation was its use in a node this morning. The node was considered and janitored, removing the target attributes.

      My personal take is that any link that is meant to forcibly open a new window is b0rken, in that it's for *me* to decide if I want that link to open in a new window or not. Similarly, links that don't work when they are forcibly opened into a new tab/window are equally b0rken.

      One can fairly ask what constructive purpose that attribute serves.

      yours,
      Michael
        The node was considered and janitored, removing the target attributes.

        And it seemed a bit abusive, outside of the scope of the janitorial mandate. I don't think janitors should be mucking with such trivialities of other people's compositions. Janitorial intervention should require something at least a little more dire.

        A better choice would have been to /msg the author, IMO.

        - tye        

        My personal take is that any link that is meant to forcibly open a new window is b0rken, in that it's for *me* to decide if I want that link to open in a new window or not.

        The link isn't b0rked, your browser is. HTML can't "forcibly" open a new window on your desktop. Your consent must be given. If you choose to use a browser that doesn't allow you to control that, then you are implicitly giving your consent.

        I'm going to take a wild guess and assume that you surf sites other than Perl Monks. Are you going to petition all of them to remove the "target" attribute from their links?

        The fact is that the target attribute is useful. And it isn't going anywhere. If you don't like it, you can avoid its effects... but that's an itch you have to scratch yourself.

        -sauoq
        "My two cents aren't worth a dime.";
        
Re: Deprecate target attribute in <a> tag
by tinita (Parson) on Sep 16, 2005 at 18:55 UTC
    i think it's a common practice to let all links to other sites open in new windows, and relative links staying on the same site open in the same window. maybe that could be applied here, links made of [node|node://id|...] don't have targets, links created by [http://some.other.site.example|title] get a target. (update: meant as a proposal like it could be made)
    and if you want control, use <a href...
    links that i'm unsure of, i always open in a new tabbed opera window, anyway.

      I've seen this practice quite a bit and I get the impression that a big part of the motivation for this is a misguided "don't change the channel" idea. That is, no small number of "web designers" are somewhat reluctant to include links that go off-site because such could take "customers" away from their site (reducing the number of "impressions" that they can charge their advertisers for, for example). So having off-site links open in a new window means that the visitor is still "on your site" in the original window.

      Another motivation is preventing confusion. You want visitors to realize that they've moved to another site. Frankly, most sites are way too crowded and complicated and this often makes it difficult to notice that you've jumped to a different site. So I'm not much worried about this problem at PerlMonks (this site is simple enough that what little style we have is easy to notice and we have just one small rotation of ads and I don't see those ads on other sites).

      Then there are even more valid reasons of navigation. It often makes a lot of sense to follow a link for a different site via a new window or new tab (in part because the "Back" button can be problematic and many users are shy to use it).

      But, IMO, the real culprit here are the browsers. I'm glad to hear that some browser / plug-in developers are finally looking at the problem. It is quite unfortunate that most browsers don't offer any of the following features ("undo" is almost always better than "Are you sure?"):

      • An "alternate click" for following a target="_blank" link but staying in the same window
      • A user setting for making target="_blank" open in a new tab (or just ignore it)
      • A user setting for prompting when a target="_blank" link is clicked so you can quickly pick if you want a new window, a new tab, or just stay in the same tab

      But even more unfortunate, IMO, is that they don't let you deal with not getting what you wanted (through a mistake or just being surprised by some mis-guided "web designer"'s actions) by offering any of the following features:

      • Move (copy) this window/tab to another window/tab (IE has always let you do this, but most other browsers don't by default, it seems)
      • Drag this tab out to be a separate window
      • Drag this tab from one window to another
      • Drag this window into another window so you are left with just one window that contains all of the tabs
      • Close this just-created window/tab, moving the current page back to the original window

      So I find it misguided to be overly adverse to using something like target="_blank" only because browsers are currently quite bad at dealing with it well. It should be reasonable for a web author occasionally provide a gentle suggestion that it might be best or more convenient if this or that link left the current window intact. There are times when this is a reasonable suggestion and, IMHO, a helpful default.

      For example, if you've got a big form (like user settings) that contains one or more "help" links, it can really suck to click a "help" link only to realize that you now can't see what it is talking about so you have to click "Back" and reopen it in a new window so you can consult the two windows together... only to find that your browser has thrown away all of the changes you made to the form for some perverse reason. This really sucks when you've spent 45 minutes composing a reply...

      But that target="_blank" should just be a gentle suggestion of something helpful. Unfortunately, browsers turned it into something over which you have nearly no control and several people have become quite annoyed with the feature. Perhaps because it is a behavior that is so similar to pop-up ads (which are just evil).

      I do believe in only using target="_blank" very sparingly because of the current state of both browsers and frustrated browser users.

      But I really wish the frustrated browser users would direct this frustration at the browsers (or as motivation for writing/finding a plug-in or proxy or better browser).

      I'm not sure what "deprecating" target= means. Is this just adding a statement against its use in a few key places in the site documentation? I'd be fine with that. I can't think of any other (desirable) way of "deprecating" it without disallowing it. (I'd rather not disallow it, even though I agree that it should only be used rarely.)

      - tye        

        interesting thoughts, and i agree. most users including me work around these "bugs" of their browers (all in a different way) because they got used to it...
        only to find that your browser has thrown away all of the changes you made to the form for some perverse reason. This really sucks when you've spent 45 minutes composing a reply...
        i know what you're talking about... =)

        i still hope someday there will be a browser that

        • doesn't throw away form input, like lynx
        • but has graphics and is still fast, like opera
        • lets me edit textareas with $EDITOR, like lynx
        • is extendible and can be configured, like firefox
        to all browser developers: i would pay for such a browser =)

        For FireFox, visit: [about:config], and look for browser.link.open_newwindow.

        Set it to :
        • 1 : Open in the current window
        • 2 : Open in a new window (default)
        • 3 : Open in a new tab

        He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
        Chady | http://chady.net/
        Are you a Linux user in Lebanon? join the Lebanese GNU/Linux User Group.
        In a sane TIMTOWTDI spirit, maybe it's time to resume your old idea :)

        Flavio
        perl -ple'$_=reverse' <<<ti.xittelop@oivalf

        Don't fool yourself.
      Howdy!

      Ummm... "footnote call".

      Can you back that claim up with evidence? I'm not aware of that being a common practice, let alone a recommended practice.

      I see no evidence that square-bracket links use the target attribute at all on PM.

      yours,
      Michael
        Can you back that claim up with evidence? I'm not aware of that being a common practice, let alone a recommended practice.
        i meant in WWW in general, at least that's what i see, for example in wikis. maybe i should check...
        I see no evidence that square-bracket links use the target attribute at all on PM.
        no, that was meant as a proposal. =)
        A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Deprecate target attribute in <a> tag
by CountZero (Bishop) on Sep 17, 2005 at 08:53 UTC
    Everytime you click on a link, you expect to go to a new page, don't you? Sometimes I even like it opening in a new window (or new tab, there is not much difference IMHO), esp. if it is an off-site link. I can then go back easily to the original thread by just closing the new window and not pushing "backspace" x-times.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      No I don't expect it to, why should I? (I have my browser set to "Reuse existing page" but unfortunately that doesnt make it ignore target directives).

      C.

        I said 'a new page' not 'a new window'. The World Wide Web would get very boring if you would always get the same page.

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      Howdy!

      I'm not sure how that first statement bears on the question at all.

      When I click on a link, I expect the new page to appear in the same tab in the same window, unless *I* take affirmative steps to make it pop up in a new window or tab, or some other alternative action.

      Maybe I'm a fossil, but I expect to be able to then use my Back button to get back whence I came. Some sites take steps that have the effect (and sometimes intent) of frustrating that, but that's a different rant.

      yours,
      Michael
        As I already said to Castaway, I'm not necessarily expecting a new "physical" page, but rather new content when I click on a link.

        Now, if that new content is somewhat like a sequel to the original page, I agree that it should be in the same tab/window/frame. Then it is like turning the pages of a book, one after another in a linear fashion, going back and forth by clicking backspace and the links.

        However, when the link brings you to another "story", I rather have it open in a new tab/window/frame as it will go off on a tangent and --as it were-- interrupts the original line of thought. Once I have fully explored the new line of thought, I close the tab/window/frame and I'm back in the original story.

        Now indeed you can do so yourself and keep everything under your control. That's OK. But sometimes it is not always clear if the link is part of the original story or the start of a new one. Only the author will know and then I like it very much when he takes care and opens a new window for me if he starts a new story.

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: Deprecate target attribute in <a> tag
by TedPride (Priest) on Sep 17, 2005 at 09:09 UTC
    I usually open links in new windows anyway, so why not automate the process?
      Because strangely, not everyone does. And as has been observed already, it seems that most browsers do not provide a mechanism for ignoring target directives. It's fine if you want to automate it for yourself, just don't force other people.

      In fact, I'd propose we implement that "set target for external links" (ie http://, google://, cpan:// etc), and have a setting for it that defaults to off - solved for everybody. (Or indeed, defaults randomly to off or on, seeing as this seems to be a 50-50 preference)

      C.

        I second this suggestion!

        CountZero

        "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

      Howdy!

      I missed the smiley. There must have been a smiley. That can't have been a serious suggestion.

      yours,
      Michael

        I don't see why should there be a smiley if there was not one in the root node. Both suggestions are silly just the same. One person wants all links to open new windows, other no links. I don't see how are these different. And I don't see why would they be any better than keeping thecurrent situation, when the link does (by default) whatever the author intended.

        Jenda
        XML sucks. Badly. SOAP on the other hand is the most powerfull vacuum pump ever invented.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: monkdiscuss [id://492688]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-09-27 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (119 votes). Check out past polls.

    Notices?