3 ms·
A few years ago, it was widespread advice that you shouldn't host a copy of jquery on your own server, and instead you should include it from cdnjs or jsdelivr
by michaelt 5y ago
A few years ago, it was widespread advice that you shouldn't host a copy of jquery on your own server, and instead you should include it from cdnjs or jsdelivr in the hopes users would have it cached, having needed it on another website.
This advice is now obsolete, because it was realised sharing caches between sites was a privacy problem. Evil.com can request example.com/logo.png and if it loads instantly, know that you've visited example.com before.
- moffkalast 5y agoYeah at best that'll break your site when the library has the next update, changing random things that nobody asks for. And you'll get a swapped malicious file at worst.
- michaelt 5y agoWell, back when that was common you'd import a numbered version, like "https://cdn.example.com/js/library-v1.2.3.js https://cdn.example.com/js/library-v1.2.3.js" which, unless the CDN was evil, would be immutable. Someone even came up with a standard for "subresource integrity" [1] where you could specify a checksum of the thing you were importing from a CDN, so it couldn't be replaced by an evil CDN. I don't believe it ever achieved widespread use. [1] https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity https://developer.mozilla.org/en-US/docs/Web/Security/Subres...
- dexterdog 5y agoIt doesn't need widespread use since you get the benefit of using by just using it on your own site.