Happening now | Office Hours: Customizing Your Theme With Moeed | Ask your questions now!

Re: Open link in same window and tab

How do I make links open in the same window and tab?

daisyweber
Explorer
52 0 7

Hi there,

 

On the homepage https://regeljebusiness.nl/ I have a section called "Het software landschap" with links to my collection pages. Right now they all open in a new window. I've added _self. But that's still not working. What am I doing wrong here?

 

Example link:

 

<a href="https://regeljebusiness.nl/collections/boekhouding" target="_self">➤ Boekhouding</a>

 

 

Replies 10 (10)

JayAdra
Shopify Partner
195 15 53

Using _self or simply removing the target attribute should work. I opened your store and edited the code using Chrome Dev Tools on my end and it opened in the same window.

 

Double check it's saving properly with your changed code for those links.

daisyweber
Explorer
52 0 7

Hi Jay, thanks! i saved it correctly and the right code is still there. But it's not coming through on the website.

daisyweber_2-1646305005853.png

 

JayAdra
Shopify Partner
195 15 53

It must be that either:

 

  • It's not saving properly (or the changes are being saved but not published?)
  • Shopify is replacing your links for some reason
  • You're editing a different link to the one you're checking

 

The first seems the most likely, but it's hard to say.

daisyweber
Explorer
52 0 7

No, shopify is replacing it. I check by changing the text and that comes true. But they keep publishing the link without the _self in it.

Halothemes
Trailblazer
168 30 47

Hi @daisyweber ,

 

We checked your homepage and found that the <a> link currently has target="_blank". Now when someone clicks on the link, it will open up in a new tab:

Screenshot_1.png

 

Double check that it saves properly with the changed code.

 

Also you can check this link for information about <a> target attribute: https://www.w3schools.com/tags/att_a_target.asp

 

If you feel like my answer is helpful, please mark it as a SOLUTION. Let me know if you have any further questions.

Best regards.

HaloThemes - Top Premium Shopify Theme Provider
Ella Shopify Theme OS 2.0 - #1 Best Selling Shopify Theme of All Time
Want to try Shopify? Open a Store for FREE

daisyweber
Explorer
52 0 7

That's strange, because if i go to the website customizer the changed code is still there. See screenshot. I've put this in an text section burb. Maybe this section changes the code? Because as you can see, the right code is still there.

daisyweber_0-1646304811089.png

 

cartcoders
New Member
10 0 0

Don't use and attribute! Just use this one for the html code 

"<a href="https://regeljebusiness.nl/collections/boekhouding"> Boekhouding</a>"

 

Also check the below screenshot where you will get 2nd option to prevent links open in new window.

 

image_2022_03_03T10_37_12_676Z.pngimage_2022_03_03T10_37_51_811Z.png

 

Let me know if still you are facing the issue

Shopify Experts | Email:- contact@cartcoders.com | Call an Expert:- +1 (647) 510-0106
daisyweber
Explorer
52 0 7

Thank you for your reply. I have no such options since I'm putting html in a text section. See:

daisyweber_1-1646304936279.png

 

MS_WEB_DESIGNER
Shopify Partner
695 52 135

Hi @daisyweber,

I am Anni From https://www.task4store.com/  - Shopify Small & Custom Tasks Experts ( By MS Web Designer - Top Rated Shopify Certified Experts and eCommerce Consultant from Singapore )

Here are the Solutions!

<a href="https://regeljebusiness.nl/collections/crm-systemen">➤ CRM-systemen</a>

Don't use target attribute

image_2022_03_03T10_53_44_330Z.png 
If you have any concerns feel free to ask me!

Regards,
Anni

banned
daisyweber
Explorer
52 0 7

Hi Anni, thanks for your reply. Unfortunately after saving Shopify automatically replaces the link with target _blank in it. I can't seem to fix this 😞