WordPress.org

Ready to get started?Download WordPress

Ideas

Default Links to Open in New Window - i.e. Target = _blank

  1. Amanda
    Member

    12345

    When I create links within the Admin for my site/Blogroll (i.e. not in a post), 99.9 times out of 100 I want the link to open in a new window. Yet, if I forget to set this option it defaults to _none and opens in the same window.

    To make it worse, all of the default WordPress links are also set to open in the same window. If I choose to keep these links, I have to edit them all one by one to open in a new window else risk losing visitors.

    Please default this setting to "_blank" in the Admin.

    Posted: 3 years ago #
  2. freelancephp
    Member

    12345

    There are several reasons why it's hardly likely the target will be set to _blank by default, f.e.:
    - it's considered a bad practice and less accessible for users (although I respectfully disagree)
    - the target attribute is not XHTML Strict valid
    - it defines how the browser should behave and behaviour "should" be handled by JavaScript and not by html

    But there are several plugins, f.e. one I wrote, which will solve your problem and automatically opens all external links in a new window.

    Posted: 3 years ago #
  3. Justin Tadlock
    Member

    12345

    If anything, let's get rid of the target setting altogether and use the browser default (opening in the same window).

    Posted: 3 years ago #
  4. Ian Dunn
    Member

    12345

    If the user wants to open it in a new window then they can easily do that on their own, without it being forced on them. In my experience website owners usually want to force links in new windows because they're worried about losing traffic, but that's the wrong way to handle it. You should build an audience by creating good _content_, not with annoying tricks.

    http://www.smashingmagazine.com/2008/07/01/should-links-open-in-new-windows/

    Posted: 3 years ago #
  5. I have a plugin at http://thisismyurl.com/downloads/wordpress/plugins/external-link-to-new-window/ that will do it for you. It opens external links into a new widow, gives you the choice to include an icon or a nofollow attribute.

    If you want, you can pull it apart and put the relevant code into your functions file as a default.

    Chris

    Posted: 2 years ago #
  6. Mex Ale
    Member

    Hi,

    I am sorry but I find most relevant people here to solve my query. I tried posting it many times but no one is replying.

    Actually my website's all links started opening in new window. I had deleted and deactivated all the plugins but its still happening the same way.

    Link to website http://www.topgradepapers.com

    when you click on any link either external or internal it opens in new window.

    And another annoying this is that it happens only in Firefox and Chrome. Its not happening in the IE or opera.

    Please help. Thanks :)

    Posted: 2 years ago #
  7. Ipstenu (Mika Epstein)
    Half-Elf Support Rogue & Mod

    Mex Ale - The support forums are in http://wordpress.org/support

    This forum is for ideas and suggestions to improve WP :)

    Posted: 2 years ago #
  8. GranPaSmurf
    Member

    I too would like the option to set my default to opening in a new page. Of course I would like to keep users on my page, however I think it is courteous to the user to open in a new window. Since our site has dozens of links that are updated frequently, keeping the top page open allows users to easily refer back to the page with other links.
    I will be investigating some of the suggestions posted above.

    Posted: 1 year ago #
  9. Amanda
    Member

    12345

    Since I first posted this request, I've just started adding this little snippet of JQuery to launch all external links in new windows:

    $("a").filter(function() {
            return this.hostname && this.hostname.replace('www.','') !== location.hostname.replace('www.','');
        }).attr('target', '_blank');
    Posted: 1 year ago #
  10. GranPaSmurf
    Member

    shedonist,
    If you can give me a little more guidance I want to give this a try. Where does this code go? Is it in the CSS stylesheet?
    Guys above: I don't want you to change WordPress defaults to suit just my needs. I am, however, wishing there were a way I could set the link defaults to suit me in MY own WordPress installations.
    Christopheross Thanks but as with shedonist's code, I am not enough of a programmer to make use of the code without a bit more guidance.

    Posted: 1 year ago #

RSS feed for this topic

Reply »

You must log in to post.

  • Rating

    12345
    10 Votes
  • Status

    This is plugin territory