Jump to content

None coder - Java script libraries are not up to date

Recommended Posts

  • Replies 1
  • Views 649
  • Created
  • Last Reply
10 hours ago, coneill659 said:

Hubspot website grader says that java script libraries on the site are not up to date and need to be updated with security patch. What do I do to update this?

jQuery is a JavaScript library that simplifies programming. It makes it easy for non-developers to add code to websites like Squarespace, so you'll find lots of code examples on this forum that have been written in jQuery by people who are learning to code. These snippets of code need to load jQuery before they will work. 

For example, you'll find a line of code on your website in Settings > Advanced > Code Injection that looks like this:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>

This loads a very old and insecure version of jQuery known as version 2.2.0. In fact, on your site it appears more than once, but it shouldn't.

 

To update jQuery to the latest version, remove the outdated code (all of them), and add the latest version instead. You only need to add this once.

<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>

The example above is for version 3.5.1, which is the latest version of jQuery today (May 2020), but you should update this when a new vulnerability is discovered. If you are reading this post months or years later, you'll find details of the latest version here.

One word of caution. After you've updated jQuery, check that your code still works correctly. This is because the newest versions of jQuery may not contain all the functions from old jQuery libraries. If this is the case, you may need to re-write the code snippet that relies on jQuery.

 

  If this helps you, please click "Like" below  ⬇️

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.