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!

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

Development Tools Introduction to Front End Performance Optimization Combine and Minify Assets Optimize JavaScript

Alex Hort-Francis
Alex Hort-Francis
17,067 Points

Requesting & downloading the same Javascript library (hosted vs local)

This is interesting: what Nick is saying towards the end of the video sounds as though modern browsers are likely to download the same file even if it is already cached by the user's browser if it is hosted by the website, as opposed to an external server.

I wonder further about the exact logistics of this: does the browser not check things like the file name for already-cached versions, for example?

I imagine there are other advantages to using 'hosted libraries' in the way he recommends as a default best practice, such as keeping libraries used on the site up to date automatically.

Does anyone have any further opinions on this topic?

1 Answer

Steven Parker
Steven Parker
228,077 Points

The file name alone is not sufficient to identify a file, it must have been cached from the same location. For example, two websites (or even two pages on the same site) might have very different sounds in a file named "beep.wav".