Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
brooxie

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!

Share this post


Link to post

OK, I just upgraded to a business plan. 

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

Thank you for your help!!

Share this post


Link to post
Posted (edited)
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

You can send your question to my email to get faster answer.

How to Setup Password & Share URL  Squarespace Customer Care

I'm overloading. Will reply all questions this month.

Share this post


Link to post

Create an account or sign in to comment

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


×
×
  • Create New...