Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML jQuery Basics (2014) Introduction to jQuery Ways to Include jQuery in a Project

Jquery is cached in our system??


I am not sure if I am saying this correctly, but the instructor talks about JQuery that is hosted on a CDN being cached in our PC.?? not sure of this meaning

He said that if we have already visited a site with JQuery, not sure about this part here..., but something stays cached in our PC.

Can you please explain how JQuery hosted on a CDN gets cached on our system.


4 Answers

Kevin Korte
Kevin Korte
28,148 Points

A browsers cache is like it's little folder of stuff to remember. When you go to a site that uses jQuery on say google's CDN, the browser automatically cache's that file. So when you move around the site, the browser doesn't have to keep reloading that jQuery script. It sees the script link is the same as the one it has cached, so it uses it's cached copy, which helps to speed up the loading process.

Now let's say the user goes to your site and you have that exactly same version of jQuery from google's CDN on your site, as some other site the user was on before. The browser will go through the same process, and use the cached version of jQuery from the site before, thus speeding your website up.

If that cached version doesn't exist, it just simply reloads the script from the link attribute.

When something is cashed it simply means that it is saved on your computer. Since the jquery file is the same there's no need for your browser to keep downloading it for all sites. So to speed up your loading time the file only needs to be downloaded once. That is until you clear or delete them.

Thanks guys! I know where to go to see cookies that are stored in my browser. Where can I go to see where these files are cached in my PC? Overtime, can these caches slow my pc down? Should I clear them up from time to time?

Kevin Korte
Kevin Korte
28,148 Points

In your browser's address bar type about:cache and it should return a list of everything that is currently cached in the browser. Modern browsers are incredibly intelligent with how they handle cached items. There should be only a very limited amount of memory that is dedicated to storing these cached files, so they should never have a noticeable effect on your systems performance. Also, cached assets are almost always set to expire.

If you have issues with websites not loading what you think is the correct content, you can clear the cache in the browsers settings, an it will than have to reload the most recent resources when you refresh any website.

Oh, I see. :) Thank you Kevin!!!

Just one thing, how is a web site not loading properly related to the caches in my system.