Forums

Links opening in the same new window. (9 posts)

  1. planetphillip
    Member
    Posted 7 years ago #

    Hi,
    I have quite a few links and they are all set up to open in a new window. However the first link clicked opens a new window and any others use the same new window. How can I get them to open individual windows?
    TIA
    Phillip

  2. prara
    Member
    Posted 7 years ago #

    Does this work: NameOfMySite

  3. planetphillip
    Member
    Posted 7 years ago #

    Yes, if i put the html code in the page directly each link opens in a individual window.

  4. prara
    Member
    Posted 7 years ago #

    So that is what you want, right?

  5. planetphillip
    Member
    Posted 7 years ago #

    OK, problem solved. After prara posted the code point it got me thinking about the code in MySQl db. I actually imported all my links directly into the table but instead of putting "_blank" I put "blank". DOH! At least I've leanrt the difference now. All I need to do is convert all 244 links to "_blank" now. Anybody know an easy way besides reimporting the data?

  6. shadow
    Moderator
    Posted 7 years ago #

    Here Phillip - a shield - an emergency medical kit - and oh yes - you will need these happy pills - I somehow think you have tough times ahead :) Ouch!

  7. MattRead
    Member
    Posted 7 years ago #

    You could make a javascript like this one:
    function externalLinks() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
    anchor.getAttribute("target") == "blank")
    anchor.target = "_blank";
    }
    }
    window.onload = externalLinks;

  8. Beel
    Member
    Posted 7 years ago #

    Just do an update of wp_links:
    UPDATE wp_links SET link_target = REPLACE ( link_target,
    'blank',
    '_blank' );

  9. planetphillip
    Member
    Posted 7 years ago #

    MattRead: Thanks for the code but I decided to replace the data because I wanted to make a few other changes.
    Beel: Also, thanks for the code but I had no idea how to run that code. ANyway I just emptied the table and loaded a text file.
    Thanks for the replies.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.