href link target="_self" opens in a new tab

Solved
Highlighted
New Member
2 0 0

We have some custom code in the Simple theme that I believe was working perfectly until recently. We have a link in our Header.liquid file to take our customers to our external buyer's guide to find parts that fit their vehicle, and then we have a link on that external site to bring them back to our Shopify store. We have the link in Header.liquid set to target="_self" but instead the link opens in a new tab, which is confusing to the customer, especially if they go back and forth a few times and end up with several tabs open. Is there something we're missing or is there a work-around to get this link to open in the same tab and make the experience more seamless?

Header Screenshot.jpgCode.jpg

0 Likes
Highlighted

if you check your DOM that link appears to have a target="_blank" not target="_self".

So there's a JavaScript changing the target="".

If it worked previously my question is, did you install any apps, lately, that could have change the behaviour of your site?!

 

⚡️ [Shopify Themes]: Lightning-fast, Highly converting, SEO-optimized, Minimal.
⚡️ Need help with your store? [Get a quote]
Highlighted
New Member
2 0 0

Thank you for teaching me something new. It appears that if I go to the webpage in my browser, right-click the page and select "View Page Source", I'm seeing the raw HTML, but if I right-click the link and select "Inspect", then I'm seeing the resulting DOM. Did I say that right? Is there a way to debug further besides trial and error, and is it possible that this behavior was implemented by Shopify? Thanks again. You've been a great help.

Code.jpg

0 Likes
Highlighted

This is an accepted solution.

That's right, yes! DOM is manipulated after the page is loaded and it's different from source code.

It could be both, honestly. I've never had Shopify changing my URLs... so it might be an app you've installed or your theme.

⚡️ [Shopify Themes]: Lightning-fast, Highly converting, SEO-optimized, Minimal.
⚡️ Need help with your store? [Get a quote]