Support » Plugin: External Links - nofollow, noopener & new window » Can’t set internal links to open in new tab

  • Resolved anjanphukan

    (@anjanphukan)


    Hi,

    I am using ThirstyAffiliates to create affiliate links in my site and it creates the Cloaked URLs with the same domain name ahead. Now I want to open those Cloaked URLs in new tab. But as the domain name is same, so External Links plugin consider them as internal links and opens in same tab.

    Also I am using Elementor plugin to build the pages. In the demo page, I added the Cloaked URLs in different ways and set some of them as “Open in new window”. But this doesn’t work.

    ThirstyAffiliates plugin adds .thirstylink class, so I added it in “Exception”. But it doesn’t work.

    I tried data-wpel-link="ignore" but it didn’t work for me.

    Also I tried this:

    jQuery(function ($) {
        $('.thirstylink').prop('target', '_blank');
    });

    and

    jQuery(function ($) {
        $('.customClass a').prop('target', '_blank');
    });

    but without luck.

    Thanks.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WebFactory

    (@webfactory)

    Hi,

    I’ve tried manually running
    $('.thirstylink').attr('target', '_blank');
    in the console on your page and it works. So double-check your code, use .attr instead of .prop. Add an alert() somewhere around that code so you’re sure it gets executed. Maybe it’s just cache messing with you.

    If you have a minute, please rate the plugin. It’s what keeps support going. Thank you! https://wordpress.org/support/plugin/wp-external-links/reviews/#new-post

    Hi,

    I added this code in the footer:

    jQuery(function ($) {
    	alert('before');
    	$('.thirstylink').attr('target', '_blank');
    	alert('after');
    });

    The alert() messages can be seen but the target attribute is not working.

    The site doesn’t have any cache plugin installed.

    Thanks

    Plugin Author Alexandru Tapuleasa

    (@talextech)

    Hi,

    I’ve looked into the issue and it looks like WP External Links is adding target=”_blank” as it should but you have some JavaScript code that runs after the page is loaded that removes the target attribute’s value.

    Here’s a screenshot of the source code with JavaScript disabled: https://prnt.sc/qlz0yv

    So you will need to find what other plugin or custom JS is affecting the target attributes of your links. WP External Links has no JavaScript in the Front-End so there is nothing else we can do on our end πŸ™

    Okay, found the issue. ThirstyAffiliates has this option and it works now. Thank you.

    Plugin Author Alexandru Tapuleasa

    (@talextech)

    Awesome! πŸ™‚

    If you have a minute, please rate the plugin. It’s what keeps support going. Thank you! https://wordpress.org/support/plugin/wp-external-links/reviews/#new-post

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.