Jump to content

How to optimize javascript files so my website loads faster?

Recommended Posts

Site URL: https://huntersgaragepa.com/

Hello!

My homepage loads slower than I would like, and I think that might have to do with my javascript files. I read somewhere that having the js files in the header area slows page load time because of the retrieval of js files before the content on the page. I have some javascript in Settings > Advanced > Code Injection > "header" and "footer". 

I would be very appreciative if you could help me or give me some advice. 

Thank you.

edit: It seems the javascript files that are affecting the load time of my website are from squarespace itself... I still would like to know if there is a better practice when adding little bits of javascript, like I have in "header" and "footer".

Edited by huntersgaragellc
Link to comment
  • 4 weeks later...
  • Replies 2
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

On 2/1/2022 at 9:32 AM, huntersgaragellc said:

Site URL: https://huntersgaragepa.com/

Hello!

My homepage loads slower than I would like, and I think that might have to do with my javascript files. I read somewhere that having the js files in the header area slows page load time because of the retrieval of js files before the content on the page. I have some javascript in Settings > Advanced > Code Injection > "header" and "footer". 

I would be very appreciative if you could help me or give me some advice. 

Thank you.

edit: It seems the javascript files that are affecting the load time of my website are from squarespace itself... I still would like to know if there is a better practice when adding little bits of javascript, like I have in "header" and "footer".

You might consider minifying your larger JS files so that the load time is decreased. There are plenty of free tools online that can do this for you. Here is one of my favorites: https://www.toptal.com/developers/javascript-minifier/

Feel free to email me with any customization inquiries or questions you may have!

Free Squarespace Resources: DevTools Minicourse,  11-Step Guide to Improve Custom CSS, Free Product/Pricing Comparison Table Generator

Link to comment

You are currently loading two different versions of jQuery which will slow down your site. Ideally you shouldn't need jQuery at all because most code can be written more efficiently in pure JavaScript, but you definitely shouldn't have more than one version on your site. For good security, ensure it is the latest version.

About me: I'm Paul, a SQSP user for over 18 yrs and a Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL, providing high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji below. Buying a coffee is optional.

Book paid help with domains: Connect a GoDaddy domain. Connect a Squarespace Domain. Domain assistance

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.