Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1076711

    Hi, many thanks for a great theme!

    I getting warnings in Chrome Dev Tool Audit för “Links to cross-origin destinations are unsafe”

    They are caused by the Social Icon (Facebook) in my footer and an external link in the top meny (Kundtjänst).

    I noticed the themes page editor supply links with <rel=”no opener”> when you check the box for “Open in blank page”

    It would be great If the theme did the same with all links who are supposed to open in a blank page.

    Can I fix this my self and how?

    #1076921

    Hey Mountaingrove,

    Where do you see those error messages? I inspected your site in Chrome but I can’t see any in there.

    Best regards,
    Rikard

    #1076963

    what happend if your links go to a https link ( you can have inserted both variants – but take the https one please)

    it that does not bring any success you can try this here (and play a bit what you want) in child-theme functions.php

    What does the code do: every link that do not fit with your domain url (internal links) get the target blank ( you can get rid of that line) and will get the rel you like.

    PS : i would advice you to use noreferrer on that:
    read here: https://developers.google.com/web/tools/lighthouse/audits/noopener

    rel=”noreferrer” attribute has the same effect, but also prevents the Referer header from being sent to the new page. See Link type “noreferrer”.

    to avoid those things from internal links ( your domain) and from e-mail (and maybe encrpyted one) and telephone links – this could be the code to use:

    add_action('wp_footer', 'open_external_links_in_newtab');
    function open_external_links_in_newtab(){
    ?>
    <script type="text/javascript">
    (function($) {
      var domainUrl = window.location.origin;
      $('a').not('a[href*="'+ domainUrl +'"], a[href*="mailto:"], a[href*="tel:"], a[href*="javascript:;"] ').attr({
        'target':'_blank',
        'rel': 'nofollow noreferrer',
      })
    })(jQuery);
    </script>
    <?php
    }
    #1076972

    One big thing on that – what happens to youtube links from an iframe or embedded video?
    Can we influence the links from that?

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