3 ms·
You could do something like: <script src="my-copy-of-jquery.1.9.2.js.min" cannonical-uri="https://jquery.com/jquery.1.9.2.js.min" hash="SHA1-bla
by maggit 13y ago
You could do something like:
<script
src="my-copy-of-jquery.1.9.2.js.min"
cannonical-uri="https://jquery.com/jquery.1.9.2.js.min"
hash="SHA1-blablabla"
></script>
With this setup:
1. Old browsers could work as before
2. New browsers could download your resource and cache it with the cannonical-uri and calculated (not declared!) hash as cache key (no dependency on third party CDNs)
3. New browsers could serve this resource from cache if it had downloaded it before with matching cannonical-uri AND hash, disregarding src and host
The hash would make sure that the jquery the user downloaded from whereever would indeed be the same jquery you are serving up.
----
Going back to your original idea, browsers could absolutely come with prepopulated caches for such resources, but they might as well fill these caches on demand.
The important thing in both cases would be to allow shared caching between sites without forcing everybody to agree on which CDN is the most pleasing. Notice that the cannonical-uri is only a name, it is not supposed to be dereferenced.
- 3825 13y agoThat looks beautiful. So the hash basically says "I trust this source"? >>The important thing in both cases would be to allow shared caching between sites without forcing everybody to agree on which CDN is the most pleasing. Notice that the cannonical-uri is only a name, it is not supposed to be dereferenced. Yes, you put it much better than I could have. Thank you!