WordPress.org

Support

Support » How-To and Troubleshooting » Opening Link is new tab

Opening Link is new tab

  • In all the WP themes i use, when i click a Link. It opens up in the same tab.
    Is it possible to open the page in a new tab.

    NOTE: I am using Firefox.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Right click and select Open Link in New Tab.

    Short and sweet reply, moshu.

    I think what sreenadh was asking is how can I (the developer) force the link to open in a new tab. If that’s the question, the answer is:

    You can’t.

    As you probably know, you can use “_blank” for the target attribute to open a link in a new window but not in a new tab. In any case the target attribute is depreciated and probably for a good reason:

    Clicking on links which don’t show the results in the current window is almost always confusing for the users.

    target is depreciated only in XHTML 1.1 and XHTML 1.0 Strict not in XHTML 1.0 Trans or below.

    This may be a botchy solution possibly worth considering for old links: using the Search and Replace feature in wp-admin to search for:

    <a href=”

    and replace it with

    <a target=”_blank” href=”

    That way any links without the new page/tab code will now have it, although I’m not sure if it’s bad to have it double tagged, and it certainly is only good for a once off “clean-up” if you’re now using the blank tag, and want to clean up old posts.

    You can do what flammobammo did above, but before that replace target="_blank" with (space or nothing) so that you don’t get a repeated attribute.

    target=”_new” will open a link in new tab for firefox.

    Sweet sreenadh, I’m going to use that from now on, and replace all my “_blank”‘s !! Cheers!

    sreenadh, how does IE take it?

    target=”_new” will open a link in new tab for firefox.

    What the hell is that? W3C lists 4 reserved: _blank, _self, _parent and _top and makes no mention of _new:

    http://www.w3.org/TR/REC-html40/types.html#type-frame-target

    That makes _new illegitimate, no? Unless you can point me to the right page at W3C?

    I have just tried it and it doesn’t work. It will open a new browser instance, not a new tab. In fact, you can try anything as the target (_old, _broken, _crap, whatever), it makes no difference as anything other then _self, _parent and _top is interpreted as _blank and therefore a new page.

    If a _NEW/_BLANK link opens in a new tab or same tab depends on how the browser (that use tabbed browsing) are set up, IE and other non-tabbed browsers will open them in a new window.

    “If a _NEW/_BLANK link opens in a new tab or same tab depends on how the browser (that use tabbed browsing) are set up”

    That’s right, Firefox (1.5) gives you the configuration choice of “new window”, “a new tab in the most recent window” and “the most recent tab/window”.

    But as I was trying to show, this has nothing to do with target=”_new”, it’s a browser thing only. The target value can be almost anything, as long it’s not only numbers (I think). There is no need to have the leading underscore.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Opening Link is new tab’ is closed to new replies.
Skip to toolbar