Jump to content

Links Open in New Tab Desktop Only

Recommended Posts

Site URL: https://sisterswhohustle.co/

I'm trying to figure out how to make text links and image links open in a new window on DESKTOP ONLY.

But I'd like these same text links and image links to open in the same window on mobile.

I'm using the SKYE template. Is this possible?

Reason being, all my external links go to Amazon to push affiliate sales. If I have "open in a new window" turned on, the links won't automatically open in the Amazon app on mobile and I need them to. But when I uncheck "open in a new window", they DO open in the Amazon shopping app automatically on mobile, but redirect away from my website on desktop.

Thanks in advance!

Link to comment
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

8 hours ago, brooxie said:

OK, I just upgraded to a business plan. 

What's the code I need to add and where?

Thank you for your help!!

Try adding to Home > Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
  // by tuan phan - squarespace forum
  $(document).ready(function() {
    if (jQuery(window).width() < 640) {
    $(".html-block a").attr('target','_self');
    }
});
</script>

 

Edited by tuanphan

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.