How to open only external links in new tabs on Impulse theme?

Heya,

I am trying to open all external links in a new tab to keep the costumer stream going. I got suggested to use.


Sadly it opens pretty much all links in a new tab (Menus etc.). I’ve also tried many other options but non of them did the trick. I am using the Impulse theme. I also tried using filters and everything else but again, nothing works on my theme. I’ve tested it on debut and had no problem with any one of the tries. So my best bet is to try and modify this piece of code since it is the only one that did something for Impulse.

Thank you in advance for the help :slightly_smiling_face:

Hello,

Welcome to the shopify Community.
I read your problem and it seems that I need to analyze your website to provide solution here.
Would you please share your website URL and if your website is password protected then also provide password.

2 Likes

removed

Your website is password protected. Please provide password.

1 Like

My bad, updated it above :slightly_smiling_face:

@itsolidude12 Let me know where you have put the code.

1 Like

Removed it. But i can re add it if you require it. It was under Theme.liquid

Yes please add it between in theme.liquid

1 Like

Done :slightly_smiling_face:

I can see that all links are opening in new page.

1 Like

Yes, but i only want external links to open In a new tab. When I click on my menu for example it also opens it in a new tab, which I don’t want

Hi Shopify Team -

I wanted to see if you had a solution yet for the question asked here - i.e. what code or settings would result in external links opening in a new browser tab.

Thanks in advance for your help with this.

@Riveting Hey man,

I found a solution after playing around a lil. Put this in the Theme.liquid at the top under .


3 Likes