TrademarkTours Posted December 3, 2021 Share Posted December 3, 2021 Site URL: https://www.trademarktours.com/hmc On our site we use the button in the header to send people to a booking page. For this one specific page on my site, I want that button to take them to a different booking page. Can I accomplish this with a header injection code? (So far I've only succeeded in adding an extra design-less button rather than changing the existing button) Link to comment
Solution Beyondspace Posted December 4, 2021 Solution Share Posted December 4, 2021 15 hours ago, TrademarkTours said: Site URL: https://www.trademarktours.com/hmc On our site we use the button in the header to send people to a booking page. For this one specific page on my site, I want that button to take them to a different booking page. Can I accomplish this with a header injection code? (So far I've only succeeded in adding an extra design-less button rather than changing the existing button) Try adding to Home > Settings > Advanced > Code injection, footer <script> (function() { document.addEventListener('DOMContentLoaded',() => { document.querySelector('#collection-619679f0e67cea457538c10c .header-actions--right .header-actions-action--cta a').setAttribute('href','/home'); }) })() </script> Change the '/home' with the slug/url you want to redirect Let me know how it works on your site Press 👍 or mark this answer as solution to help another one too tuanphan 1 Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword HighlighterIf you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you Link to comment
TrademarkTours Posted December 5, 2021 Author Share Posted December 5, 2021 This was perfect, exactly what I was looking for! Would you be able to tell me how you got the collection # so I can attempt this on some other pages? Link to comment
Beyondspace Posted December 5, 2021 Share Posted December 5, 2021 (edited) You can use the chrorme exxtension: Squarespace ID Finder Here is how to find the page id: http://recordit.co/qwnj09oNCa Hope that it can help you Edited December 5, 2021 by bangank36 Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword HighlighterIf you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you Link to comment
TrademarkTours Posted December 5, 2021 Author Share Posted December 5, 2021 Amazing, you rock! Thanks very much for all your help Link to comment
ekspohz Posted January 16, 2022 Share Posted January 16, 2022 Hi @bangank36 I am trying to accomplish the same thing with the button in the navigation at https://www.museoutdoors.com/get-started - I would like to redirect it to a different page. I think the code is different given this page is on Brine. Could you advise? Thanks! Link to comment
tuanphan Posted January 17, 2022 Share Posted January 17, 2022 @ekspohz Try this adjusted code <script> (function() { document.addEventListener('DOMContentLoaded',() => { document.querySelector('#collection-61d9dcf755b23e793054204b .Header-nav--secondary a').setAttribute('href','/home'); }) })() </script> ekspohz 1 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
ekspohz Posted January 18, 2022 Share Posted January 18, 2022 17 hours ago, tuanphan said: @ekspohz Try this adjusted code <script> (function() { document.addEventListener('DOMContentLoaded',() => { document.querySelector('#collection-61d9dcf755b23e793054204b .Header-nav--secondary a').setAttribute('href','/home'); }) })() </script> Perfect! Thank you @tuanphan Beyondspace and tuanphan 2 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment