Shopify themes, liquid, logos, and UX
Hey guys,
We were using code to open external links in a new tab (using this tip https://ed.codes/blog/shopify-open-external-links-in-new-tab) up to Version 9; however, the code no longer works after subsequent updates. We are using the Craft theme. Does anyone have a solution that works for the latest version of Craft? We've tried fixes posted in here but, so far, none of them take.
Here is our store:
https://anniemccormickdesigns.com/
Thanks,
Tom
Hello @TomMc ,
There is no issue with the code you shared.
Maybe issue in your other changes which makes a conflict with this JS. I suggest reverting the changes you did recently or find the conflict manually to make it work.
Regards
Guleria
Hi @TomMc,
Please change code:
<script>
const links = document.links;
for (let i = 0; i < links.length; i++) {
if (links[i].hostname !== window.location.hostname) {
links[i].target = '_blank';
links[i].rel = 'noreferrer noopener';
}
}
</script>
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025