-
AuthorPosts
-
March 9, 2019 at 11:51 am #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?
March 10, 2019 at 7:44 am #1076921Hey Mountaingrove,
Where do you see those error messages? I inspected your site in Chrome but I can’t see any in there.
Best regards,
RikardMarch 10, 2019 at 10:43 am #1076963what 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/noopenerrel=”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 }
March 10, 2019 at 11:24 am #1076972One big thing on that – what happens to youtube links from an iframe or embedded video?
Can we influence the links from that? -
AuthorPosts
- You must be logged in to reply to this topic.