Support » Fixing WordPress » Open links in a new window

  • Resolved ppoivre

    (@ppoivre)


    Hi,

    I would like to have all my links located in my sidebar open in a new window. How can I do that. If I look in links.php i see nothing. Thru WP dashboard in the link manager there is nothing for that. Can you help.

    Thank You

Viewing 9 replies - 1 through 9 (of 9 total)
  • Are you really really sure you wanna do that? I think most people, including me, REALLY hate it when a site decides that it knows better than me…

    In the links editing section of admin near the bottom there is an advanced area. You’ll see 3 radio buttons next to “Target”. If you chose “_blank” the link will open in a new window.

    There is also a warning that it is “illegal XHTML” if you care about it validating.

    Thank you very much “Pizzaman”. To answer Viper, I also hate the new window unless it rederecting on a new site as in my case.

    I think opening in a new window when it comes to links to external websites is correct. When reading a blog and clicking on a link I then start reading and clicking on that ‘next’ site.
    After a while you don’t know anymore where you started or by accident closed the window of the original blog or website. So you have to search for it in your history. And if you haven’t closed the original window already you are supposed to hit the BACK button several times untill you are back at the beginning. That doesn’t make sense to me.

    Thankfully we have FireFox now where you can easily use the ctrl button so it opens a new tab in the same window. That works pretty neat, … in my opinion.

    Eric

    I use the javascript code below, it opens all links outside of the domain that is specified in a new window or tab. Just remember to change the domain to yours.

    function makeNewWindows() {
    if (!document.links) {
    document.links = document.getElementsByTagName('a');
    }
    for (var t=0; t<document.links.length; t++) {
    var extlinks = document.links[t];
    if (extlinks.href.search(/http/) != -1) {
    if (extlinks.href.search('/www.michael-niziol.ca/') == -1) {
    extlinks.setAttribute('target', '_blank');
    }
    }
    }
    }
    window.onload = function(e) {makeNewWindows();}

    Place it in the head section of the page or call it in an external JS file.

    Cheers,
    Michael.

    That was neat Michael, thanks.

    “Place it in the head section of the page or call it in an external JS file.”

    That instruction is opaque to many people, myself included.

    Please tell us in exactly which file it goes and where?

    Like wise, this advice is not very useable because it does not use the terminology of the software . . .

    “In the links editing section of admin near the bottom there is an advanced area. You’ll see 3 radio buttons next to “Target”. If you chose “_blank” the link will open in a new window.”

    If I go to Dashboard (which is what I think he means by “admin”, and click on Links (which is what I guess he means by “links editing section”) and click on Manage Links (whuich is the only option there that offers the possibility of link configuration so maybe that’s what is intended) there is nothing called “advanced area” and I do not see any radio buttons or “Target”.

    So at some point in the advice, either I am on the wrong page for lack of clear advice or . . . ????

    What exactly are > the > steps > to > get > to > this > setting?

    Please, when posting advice, describe what the user of that advice must see on screen, step by step, using the language and link labels of the software and avoid assumptions based on your own expertise.

    jerseyjoe: I don’t know if you figured it out.. but anyway what he means is (as how I understand it) that you should go to “Links” > “Manage Links” and then press “Edit” on the link you want to open in a new window.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Open links in a new window’ is closed to new replies.