Open product page in new browser tab only on desktop not in mobile

Solved
Highlighted
Tourist
5 0 1

Hi,

I am trying to find how to open products from collection page in new browser tab only in Desktop. I want the link to open in the same tab for Mobile

0 Likes
Highlighted
Shopify Partner
1027 215 470

This is an accepted solution.

@Loveparrotcrow 

 

Go to the Assets > theme.js file and add following code at the end of file:

$(function(){
    var productURLs = $('a[href*="/products/"]');
    if($(window).width() > 768){
        productURLs.attr("target", "_blank");
    }
});

 

Cheers,

Tejas

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
Highlighted
Tourist
5 0 1

Thanks @Tejas_Nadpara 

The solution worked. Appreciate your help