joeljanski Posted January 12, 2014 Posted January 12, 2014 (edited) I am trying to get the clickthrough URL of each image in my galleries to open in a new tab. I did some digging and I noticed that each gallery image has the <div class="margin-wrapper"> on it. So I am thinking if I can have anything that has that class open in a new tab I should be good? How can I change all external links contained within <div class="margin-wrapper"> to automatically open in a new blank target tab? Edited August 11, 2016 by acalvo retag Scoobie 1
Solution Guest Posted March 3, 2014 Solution Posted March 3, 2014 (edited) Usually I just make the link say: <a href="http://www.whatever.com" target="_blank">link text</a> So, pretty much just adding target="_blank" inside your link code will make clicking the link open a new tab (or window; depending on the visitor’s browser preferences). Not sure how to code it to be universal, or if you can. I’ve only ever done it on individual link codes. Edited July 3, 2014 by llmodbls Format
tajbarr Posted June 24, 2014 Posted June 24, 2014 (edited) To make them universal just place this code in header injection on all pages you wish all links to be forced to open in a new tab: <base target="_blank"/> Works really well. Edited June 24, 2014 by tajbarr ArminB 1
madebyjaz Posted July 30, 2014 Posted July 30, 2014 That so saved me on making the instagram block open the images in new windows! :D
dnemerofsky Posted March 15, 2015 Posted March 15, 2015 This actually worked well, except for the fact that now all links on the page open in new tabs, including my navigation items and my logo to my homepage
keren Posted May 1, 2015 Posted May 1, 2015 This worked great, except that it opens header links in a new window too. Anyone know how to get around that? Thanks!
keren Posted May 1, 2015 Posted May 1, 2015 This worked great, except that it opens header links in a new window too. Anyone know how to get around that? Thanks!
ryanrbrowne Posted June 23, 2015 Posted June 23, 2015 Would love to get an update on this. Any way to do this without it affecting the navigation links too?
ryanrbrowne Posted June 23, 2015 Posted June 23, 2015 Would love to get an update on this. Any way to do this without it affecting the navigation links too?
alexnyc Posted August 6, 2015 Posted August 6, 2015 i ended up paying this guy on fiverr to not only force external links on my blog page, but also to remove the 'read more' links. works like a charm. https://www.fiverr.com/amit_singla/fix-your-squarespace-css-or-html-code?funnel=184b7c14-52c0-4caf-85ab-aee778fd6c3e
PeterCBlanchard Posted December 17, 2015 Posted December 17, 2015 This only works if you are coding the link yourself. You can't put that stuff in the Clickthrough URL for an image . . . when I try it tells me to please enter a valid URL. Inscape 1
ronashman Posted November 4, 2016 Posted November 4, 2016 I made and account on this site JUST to answer this. That's how much thankful I am.I've been struggling with this for like 2 hours, damn it! Your answer just solved it automagically. I have a page with dynamic content generated through a php function and trying to assign the target blank attribute to links within a div class didn't work. Your solution just did. THANK YOU!!!!!!!!!!!!!!!!!!!!!!! WarwickJones 1
Byler_Media Posted June 27, 2019 Posted June 27, 2019 (edited) Just tried this and it worked to only apply to a certain block: <base #yourBlockId target="_blank"/> Edited June 27, 2019 by BylerMedia Initial Revision
clro Posted October 29, 2019 Posted October 29, 2019 Hi all, I tried adding target="_blank" to the end of my redirect url but it isn't working. I've waited approximately 30mins and it still isn't working. Any suggestions? This is what it currently looks like: https://embodhii.org/emotional-freedom2pxiu8yh"target="_blank Thanks in advance!
tuanphan Posted October 29, 2019 Posted October 29, 2019 @clro it should be <a href="https://embodhii.org/emotional-freedom2pxiu8yh" target="_blank">Text link</a> or <a href="https://embodhii.org/emotional-freedom2pxiu8yh" target="_blank">https://embodhii.org/emotional-freedom2pxiu8yh</a> 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!)
zoebrock Posted May 12, 2020 Posted May 12, 2020 On 6/28/2019 at 3:35 AM, Byler_Media said: Just tried this and it worked to only apply to a certain block: <base #yourBlockId target="_blank"/> Any idea how to add this to an external email link? thanks so much
tuanphan Posted May 12, 2020 Posted May 12, 2020 9 hours ago, zoebrock said: Can you share link to an example page? zoebrock 1 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!)
zoebrock Posted May 12, 2020 Posted May 12, 2020 4 hours ago, tuanphan said: Can you share link to an example page? Hi yes it's the same one I emailed you about 🙂 The Enquire link in the lightbox pop ups for all the images on Johngollings.com
tuanphan Posted May 13, 2020 Posted May 13, 2020 try adding to Code Injection Footer <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> $(document).ready(function() { $('[href*="mail"]').attr('target','_blank'); }); </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!)
Tarjo Posted July 15, 2020 Posted July 15, 2020 I came across this similar issue when displaying blog posts in a summary block. If the "Link Post Title to Source URL" option is selected, there is no way to make the link open in a new tab. I found a solution in another post on this form that is counter intuitive but seems to work. Adding "target="_blank to the end of the Source URL will add the target="_blank" to the html. For example: https://link-to-outside-source.com"target="_blank Yes, I know, the code looks wrong if you are use to writing html, but try it. Plus, no JS is required for those on the lower level subscriptions. SqSp_mtech, HeatherStokes, katherineforbes and 4 others 3 4
aladdinsane Posted September 4, 2020 Posted September 4, 2020 (edited) This is really easy to do, but Squarespace makes you go through several steps. All you need to do is go to the page with the link you want to edit. Choose Edit Page and then highlight the link. This should bring up the link editor (if not you can click the link button on the toolbar.) Now this is where it gets tricky. You have to go to edit, THEN you have to click the gear icon, THEN you need to switch the toggle switch to open link in new window. THEN you have to click save at the top of the link editor window. THEN you have to click "apply' at the bottom of the little link editor box. THEN you have to click on "save" at the top of the page editor to save your page. Edited September 4, 2020 by aladdinsane word jbellissimo and NEC 1 1
Inscape Posted September 15, 2020 Posted September 15, 2020 It worked! On 7/15/2020 at 7:13 AM, Tarjo said: I came across this similar issue when displaying blog posts in a summary block. If the "Link Post Title to Source URL" option is selected, there is no way to make the link open in a new tab. I found a solution in another post on this form that is counter intuitive but seems to work. Adding "target="_blank to the end of the Source URL will add the target="_blank" to the html. For example: https://link-to-outside-source.com"target="_blank Yes, I know, the code looks wrong if you are use to writing html, but try it. Plus, no JS is required for those on the lower level subscriptions. You are the only person in this whole thread who actually responded adequately to the problem of using the "Clickthrough URL" field in gallery image settings, and your solution totally works, as weird as it is! Thanks so much for solving a problem I've had for a long time! Helpful to know it works for the "Link Post Title to Source URL" feature too. LeslieIrvineDM 1
kathryn Posted November 27, 2020 Posted November 27, 2020 Hi I wonder if anyone can help. I'm also trying to set up a site so that all external links open in a new tab, but without affecting the site navigation. I've tried the following: 1. putting this in the header <base target="_blank"/> Which worked perfectly, except that now all navigation opened in a new tab. 2. applying this to a block and putting it in the header (in advanced > code injection) <base #yourBlockId target="_blank"/> for example <base #block-yui_3_17_2_1_1605228030617_24171 target="_blank"/> but it didn't do anything 3. I have put "target="_blank to the end of all the Source URLs in blog posts. Initially I thought this was working, but it seems to be erratic - one will open in a new tab, another won't. Does anyone have any idea what I'm doing wrong? You can see the site at shopportunity.ie Any advice would be hugely appreciated!
kathryn Posted November 27, 2020 Posted November 27, 2020 1 hour ago, kathryn said: Hi I wonder if anyone can help. I'm also trying to set up a site so that all external links open in a new tab, but without affecting the site navigation. I've tried the following: 1. putting this in the header <base target="_blank"/> Which worked perfectly, except that now all navigation opened in a new tab. 2. applying this to a block and putting it in the header (in advanced > code injection) <base #yourBlockId target="_blank"/> for example <base #block-yui_3_17_2_1_1605228030617_24171 target="_blank"/> but it didn't do anything 3. I have put "target="_blank to the end of all the Source URLs in blog posts. Initially I thought this was working, but it seems to be erratic - one will open in a new tab, another won't. Does anyone have any idea what I'm doing wrong? You can see the site at shopportunity.ie Any advice would be hugely appreciated! I also tried targeting the blocks by putting the code into the header on an individual page. <base #block-f9df908530b3c6b670da target="_blank"/> <base #block-925ca918fe42cd9c4071 target="_blank"/> into the header of https://shopportunity.ie/irishonlineaccessoriesstores but it seems to also work erratically - sometimes affecting the navigation, sometimes not and only working intermittently. I'm totally confused!!
tuanphan Posted December 3, 2020 Posted December 3, 2020 On 11/27/2020 at 10:58 PM, kathryn said: I also tried targeting the blocks by putting the code into the header on an individual page. <base #block-f9df908530b3c6b670da target="_blank"/> <base #block-925ca918fe42cd9c4071 target="_blank"/> into the header of https://shopportunity.ie/irishonlineaccessoriesstores but it seems to also work erratically - sometimes affecting the navigation, sometimes not and only working intermittently. I'm totally confused!! Can you share link to page? We can use some JS code to achieve this. 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!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment