Shopify themes, liquid, logos, and UX
Awhile back I hired someone to make sure all links that are external should open up into a new page, however, ALL my pages open up to a new page. I don't want this.
I just want all my external links to open up to a new page. Can someone please share how to do this. Please list all steps so it's easy to follow.
Thank you,
Hello there Kim @Kim_Thomas I suggest you try out this code here
<script>
document.addEventListener('DOMContentLoaded', function(){
var links = document.links;
for (let i = 0, linksLength = links.length ; i < linksLength ; i++) {
if (links[i].hostname !== window.location.hostname) {
links[i].target = '_blank';
links[i].rel = 'noreferrer noopener';
}
}
});
</script>
Need to see your site to understand how it works now and why it's not the way you wanted it.
The code suggested above may work for unmodified theme, but may not work for yours.
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn 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, 2025