Coding For Sense theme

Solved

Coding For Sense theme

JustCats
Tourist
7 0 1

I am using the Sense theme and need the coding to open external links in a new tab. I know about the solution from OSCProfessional, but cannot read the code because the picture is blurry. Can anyone help with this? It's turning into a whole day project. I've tried the code and it doesn't work. I don't have a theme.js or a theme.js.liquid, but I have an assets/theme-editor.js or a layout/theme.liquid. My brain hurts. I would upload a screen shot, but I don't have the right file types. Thank you! 

Accepted Solution (1)

Moeed
Shopify Partner
6719 1814 2198

This is an accepted solution.

Hey @JustCats 

 

Follow these Steps:

1) Go to Online Store
2) Edit Code
3) Find theme.liquid file

4) Add the following code in the bottom of the file above </body> tag

 <script>
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll('a').forEach(function(link) {
        link.setAttribute('target', '_blank');
    });
});
  </script>

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


View solution in original post

Replies 3 (3)

Moeed
Shopify Partner
6719 1814 2198

This is an accepted solution.

Hey @JustCats 

 

Follow these Steps:

1) Go to Online Store
2) Edit Code
3) Find theme.liquid file

4) Add the following code in the bottom of the file above </body> tag

 <script>
document.addEventListener("DOMContentLoaded", function() {
document.querySelectorAll('a').forEach(function(link) {
        link.setAttribute('target', '_blank');
    });
});
  </script>

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


JustCats
Tourist
7 0 1

I almost cried when it finally worked. Thanks for saving the day! 

Moeed
Shopify Partner
6719 1814 2198

Thank you for your reply. I'm glad to hear that the solution worked well for you. If you require any more help, please don't hesitate to reach out. If you find this information useful, a Like would be greatly appreciated.

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications