Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Alex Francis
Alex Francis
13,840 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
216,810 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".