Jump to content

Simple custom code suddenly doesn't work across multiple sites (logo swaps)

Recommended Posts

Posted (edited)

I have been using this code for ages with no issues: 

<script>
  window.onload = function() {
    document.getElementsByClassName('Header-branding-logo')[0].src = 'https://static1.squarespace.com/static/6206bdb5ff4ac21c6a8eda7f/t/6271f361756bbb4fe37cd2f5/1651635041619/clevelandDx-dark.svg';
  };
</script>

It just stopped working across multiple sites that i have built and manage. It's a simple way for me to swap the logo instance from a 'solid white' to 'full color' for specific pages. 

The file still loads properly if you enter the path in a browser. Also - - - the file format has no bearing. PNG files on other sites using the same code to implement seem to also not work. 

 

Thanks!

BRINE, SS v 7.0

Edited by jsardone
  • Replies 1
  • Views 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted

Please post the URL for a page on your site where we can see your issue. For us to see the URL you need to include the link in the content of your post. The URL field the forum software provides is not shown to us.

A link to the backend of the your site won’t work for us, i.e. a URL that contains /config/.

Please set up a site-wide password, if your site is not public and you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site.

Please read the site-wide password and how to share a link documentation to understand how they work.

You may find How to post a forum question post useful.

We can then take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

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.