Support » Fixing WordPress » Links opening in new window AND same window

  • Hi everyone

    I’ve checked my settings and “open in new window” is selected.

    Unfortunately when a user clicks on a link in a story (and also social media links and adverts too) the link opens in both a new window and the same window – frustrating.

    I’ve tried to find a previous support item like this but haven’t found one yet. It seems to have cropped up since I had a developer tweak my website last week *shakes fist*

    Can any WP-Yoda’s help me out on this one? if you want to check it out

    Thanks heaps


Viewing 11 replies - 1 through 11 (of 11 total)
  • I clicked on a bunch of links in your site — all opened in the same window that I was in. It may be partly or totally a browser preference issue…clearly my browser (Firefox 11 on a Mac) overrides your site’s settings.


    Oddly, when using Firefox some links behave as I described in my OP whereas others work properly e.g. only in a new window/tab.

    Looks like there is something funny happening.

    Good Guy


    Yes it is opeing in both windows. The solution is to check the links and to make sure they are like this:

    <a href="" target="_blank"><img alt="" src="" title="bogans.jpg" class="alignnone" width="550" height="576" /></a>


    I’ve had a look at some of the in-article links and they appear as:


    But the issue appears to be site wide, not just affecting the links in the article e.g. if you click on our social media links on our homepage, they too are affected. So it appears that the issue is being controlled by an over-riding function – though i’m not skilled in CSS so i’m not sure.

    Sorry appears as:

    `< a href=””>Seminyak’

    You need to add this

    target="_blank" — after the href=”” attribute

    to all the anchor tags

    Thanks WPyogi

    The question has to be asked – do I need to do this to every link on my site? Also, why would this have started all of a sudden, would there be a setting somewhere that would drive the automatic attachment of target=”_blank” to all my links?

    Also, how do I attach target=”_blank” to things like my social media widget s that are launching in the same AND new windows?

    Seems like a awfully lot of hard work… unless i’m missing something?

    Just noticed that you are using a commercial theme — they are not generally supported on these forums — but they typically have their own support and/or forums. So you should look there re: this issue. It does seem like there is some issue — since your settings are not having the intended effect and for sure, there is something weird with the social media links.

    I sure HOPE it’s not a manual fix — that seems pretty unreasonable (unlikely?) given that you paid for the theme…and if there is some problem with the theme, it might get erased or changed back again anyway.

    Awesome – thanks WPyogi – I will look into it.

    haydensydney – did you ever find the problem? I am having the exact same problem and cannot figure it out.


    A friend and I spoke on Facebook and this was his feedback:

    ” Looks like you have a few other external javascript resources being called on your links. The issue will definitely be a result of some javascript conflicting with your html. There seem to be a few other stat tracking tools in there aswell. Try deactivating those aswell. Im determined to try and work it out, so i’ll tinker with it and see if I can give you the precise culprit”

    “just did a test disabling all of your javascript and it definitely solves the problem. It’s just a matter of finding which script is causing the conflict. I’d suggest disabling your plugins one by one and testing. I’d also use it as a chance to disable / uninstall any plugins that you arent using. Unless it’s deferred or loaded asynchronously a browser will stop loading all other resources until a javascript file has completed downloading, so by disabling unused stuff you can see an improvement on load times. Let me know how you go!”

    “this looks like your culprit – window.onload = function () {
    var links = document.getElementsByTagName(‘a’);
    for (var x=0; x < links.length; x++) {
    links[x].onclick = function () {
    var mydomain = new RegExp(document.domain, ‘i’);
    href = getAttr(this, ‘href’);
    if(href && href.toLowerCase().indexOf(‘http’) === 0 && !mydomain.test(href)) {
    recordOutboundLink(this, ‘Outbound Links’, href);

    I’m not quite sure what that last bit means, or what plugin it refers to, but I will just disable all of my plugins one by one and see which one is playing havoc.


Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Links opening in new window AND same window’ is closed to new replies.