Jump to content

None coder - Java script libraries are not up to date

Recommended Posts

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  ⬇️

Edited by paul2009

About: Squarespace Circle Leader since 2017. I value honesty, transparency, diversity and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™. 
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Catch up on all the release notes and announcements 2023 [for Circle members only]. There's a public version here too!
If I helped, you can thank me by clicking one of the emojis below. If you prefer, you can buy me a coffee.
Improve your online store with our extensions.

Link to comment

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.