Re: Open Social Media Links in New Window - Ride Theme

Solved

Open Social Media Links in New Window - Ride Theme

GASTY
Excursionist
38 0 4

Hello,

I'm currently working on optimising my website and would like to make a small adjustment to the social media links.

Currently, when users click on the social media icons in the announcement bar or footer, they open in the same window. However, I would prefer them to open in a new window or tab to ensure that visitors can easily return to my website after exploring my social media profiles.

Could you please assist me in configuring the social media links so that they open in a new window/tab?

 

This is my website: www.gastonduflos.com

 

Thank you for your attention to this matter.

Accepted Solution (1)
devcoders
Shopify Partner
369 57 92

This is an accepted solution.

Hi @GASTY 

- Go to Online Store -> Theme -> Edit code.
- Find the file Layouts/theme.liquid and paste the code below at the bottom of the file."

 

<script>
document.querySelectorAll('.list-social__link').forEach(function(link) {
link.setAttribute('target', '_blank');
});
</script>

 

devcoders_0-1710660144499.png

 

 

Shopify Developer: Helping eCommerce Stores
If you need assistance with your store, feel free to contact us at devcodersp@gmail.com.
If my assistance was helpful, please consider liking and accepting the solution. Thank you!

View solution in original post

Replies 3 (3)

devcoders
Shopify Partner
369 57 92

Hi @GASTY 

"Target="_blank" should be inside the <a> tag.

like this:

 

devcoders_0-1710653862229.png

 

Shopify Developer: Helping eCommerce Stores
If you need assistance with your store, feel free to contact us at devcodersp@gmail.com.
If my assistance was helpful, please consider liking and accepting the solution. Thank you!
GASTY
Excursionist
38 0 4

Thanks mate. I only want all the SOCIAL MEDIA ICONS to open on a new window, announcement bar and footer. Do you know how to achieve this? Thank you!

devcoders
Shopify Partner
369 57 92

This is an accepted solution.

Hi @GASTY 

- Go to Online Store -> Theme -> Edit code.
- Find the file Layouts/theme.liquid and paste the code below at the bottom of the file."

 

<script>
document.querySelectorAll('.list-social__link').forEach(function(link) {
link.setAttribute('target', '_blank');
});
</script>

 

devcoders_0-1710660144499.png

 

 

Shopify Developer: Helping eCommerce Stores
If you need assistance with your store, feel free to contact us at devcodersp@gmail.com.
If my assistance was helpful, please consider liking and accepting the solution. Thank you!