I always self-host my JS/CSS libraries: the connection is already open (thanks to keep-alive) so what's the problem of serving a couple of more KiBs of compressed data instead of making an additional DNS request and a new connection to a CDN?
I understand that the CDN version of the library may have already been cached by the browser while visiting other websites, but does it really save that much time/traffic compared to self-hosting?
Original, jQuery CDN:
https://code.jquery.com/jquery-X.Y.Z.min.js
Google:
https://ajax.googleapis.com/ajax/libs/jquery/X.Y.Z/jquery.min.js
Microsoft:
https://ajax.microsoft.com/ajax/jquery/jquery-X.Y.Z.min.js
Microsoft ASP.NET:
https://ajax.aspnetcdn.com/ajax/jquery/jquery-X.Y.Z.min.js
jsDelivr:
https://cdn.jsdelivr.net/npm/jquery@X.Y.Z/dist/jquery.min.js
cdnjs:
https://cdnjs.cloudflare.com/ajax/libs/jquery/X.Y.Z/jquery.min.js
Yandex.ru:
https://yastatic.net/jquery/X.Y.Z/jquery.min.jsGreat opportunity to strip out unnecessary uses of jQuery, and move to vanilla javascript.
Years ago, I used to link the library from Google [1] or CloudFlare [2].
Nowadays, with all the Node.js stuff that goes around modern front-end, I don't see the point of embedding a JavaScript library from a CDN, unless that library is dependent on a remote service, e.g. Google Analytics, Google Maps, etc… That being said, if you are still maintaining a legacy website that depends on jQuery, you should consider to embed the library like this instead:
<script>window.jQuery || document.write('<script src="/js/jquery.min.js"><\/script>')</script>
One more reason to use Decentraleyes.
It's not an expiry. It's a cert name mismatch. CN is *.ssl.hwcdn.net
https://www.jsdelivr.com is a good alternative. We actually monitor for https failures and automatically remove the problematic CDN.
This is why you self-host all project dependencies.
Looks like it's working again.
Starting to see complaints, questions, etc. on twitter about it too.
Looks like its working now https://code.jquery.com
Potentially related to the Chrome 66 update and Symantec stuff?
Yep, this just broke my project :/
Looks like they fixed it
Only hobby websites would host jquery off a cdn
It is too bad that the HTML standard has no built in way to fallback.
They've added a cryptographic hash/integrity and the async/defer attributes to the script tag, but something as essential as a fallback if a script or stylesheet fails to load (which the browser is best placed to know), has no built in functionality.
Instead you're left doing JavaScript tricks which for missing CSS gets a little ugly[0]. But CDN with local fallback (or visa versa) has been common now for decades but yet no official support at all. Honestly if the integrity attribute is specified the browser should just be able to fall back to a cached copy it has (e.g. jquery.1.2.3.min.js has a crypto hash of ABC123, and I have that file already).
[0] https://stackoverflow.com/questions/7383163/how-to-fallback-...