4 ms·
> For me it is also a red flag to include third party CDN JS Why anyone would use third party js for anything other than dev work is beyond me. Are people real
by markdown 6y ago
> For me it is also a red flag to include third party CDN JS
Why anyone would use third party js for anything other than dev work is beyond me. Are people really building websites that can serve html, images, and css, but not js?
- hn_throwaway_99 6y agoThere was the use case at one point that serving a version of a popular 3rd party JS framework from a CDN would result in the likelihood of that file being able to be served from the browser's cache, because there would be a decent chance the end user had visited some other site that used the same popular framework. That no longer works, see https://www.stefanjudis.com/notes/say-goodbye-to-resource-caching-across-sites-and-domains/ https://www.stefanjudis.com/notes/say-goodbye-to-resource-ca... and https://developers.google.com/web/updates/2020/10/http-cache-partitioning https://developers.google.com/web/updates/2020/10/http-cache...
- XCSme 6y agoI think that most 3rd party providers say "DON'T HOST THIS FILE LOCALLY AS IT WILL BREAK WHEN WE MAKE UPDATES".
- markdown 6y agoWhich of course makes no sense. Why would any action they take have anything to do with a website that isn't hosting their files.
- XCSme 6y agoWell, if the JS is to connect to an end-point on their server (eg. Google Analytics) if they remove/deprecate the old API the JS file won't work anymore as it might not be compatible with the new API, so the JS file would have to be updated.
- markdown 6y agoOh sure! I guess we're talking about different things. In your example, Google is providing you a service, and they're serving the file. I was talking about using 3rd party file hosting services like cdnjs.com and unpkg.com It's gotten so bizarre that highly popular libs (even Facebook's React!!! )will recommend you hotlink these third party sites rather than give you a zip file to download and host yourself.
- XCSme 6y agoOh yeah, that use case is weird, and as another comment mentioned it no longer brings the benefit of caching.