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>
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025