brooxie Posted March 29, 2020 Share Posted March 29, 2020 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
tuanphan Posted March 29, 2020 Share Posted March 29, 2020 All text/image links? Which plan do you use? This needs to use JavaScript (Business Plan or higher) Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
brooxie Posted March 31, 2020 Author Share Posted March 31, 2020 Yes, all text/image links. I'm using a personal plan as of now. Link to comment
tuanphan Posted March 31, 2020 Share Posted March 31, 2020 As I know, you will need JavaScript to add the target = "_ blank" attribute to links on Desktop. And it needs a Business Plan. Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
brooxie Posted March 31, 2020 Author Share Posted March 31, 2020 OK, I just upgraded to a business plan. What's the code I need to add and where? Thank you for your help!! Link to comment
tuanphan Posted March 31, 2020 Share Posted March 31, 2020 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> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.