WordPress.org

Ready to get started?Download WordPress

Forums

Links opening in new window AND same window (12 posts)

  1. haydensydney
    Member
    Posted 2 years ago #

    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 freelancer.com developer tweak my website last week *shakes fist*

    Can any WP-Yoda's help me out on this one?

    http://flymefunky.com if you want to check it out

    Thanks heaps

    haydensydney

  2. WPyogi
    Volunteer Moderator
    Posted 2 years ago #

    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.

  3. haydensydney
    Member
    Posted 2 years ago #

    Interesting!

    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.

  4. Good Guy
    Member
    Posted 2 years ago #

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

    <a href="http://www.stylingyou.com.au/wp-content/uploads/2012/01/bogans.jpg" target="_blank"><img alt="" src="http://www.stylingyou.com.au/wp-content/uploads/2012/01/bogans.jpg" title="bogans.jpg" class="alignnone" width="550" height="576" /></a>

  5. haydensydney
    Member
    Posted 2 years ago #

    Hi mytaxsite.co.uk

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

    Seminyak

    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.

  6. haydensydney
    Member
    Posted 2 years ago #

    Sorry appears as:

    `< a href="http://wikitravel.org/en/Seminyak">Seminyak'

  7. WPyogi
    Volunteer Moderator
    Posted 2 years ago #

    You need to add this

    target="_blank" -- after the href="" attribute

    to all the anchor tags

  8. haydensydney
    Member
    Posted 2 years ago #

    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?

  9. WPyogi
    Volunteer Moderator
    Posted 2 years ago #

    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.

  10. haydensydney
    Member
    Posted 2 years ago #

    Awesome - thanks WPyogi - I will look into it.

  11. Trask2129
    Member
    Posted 2 years ago #

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

  12. haydensydney
    Member
    Posted 2 years ago #

    Hi

    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.

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic