10 ms·
I would say that a possible solution is also to better rank websites that mention the checksums of their external resources and make web browsers keep them in c
by d33 11y ago
I would say that a possible solution is also to better rank websites that mention the checksums of their external resources and make web browsers keep them in cache much longer... if pretty much every website uses jQuery, perhaps we should ship jQuery with the web browser?
- illumen 11y agoThere are checksums available for resources now. As of last few months. Also things like jQuery are available from multiple CDN, and they are used by many of the top websites and html frameworks. So you probably already have it in cache.
- Xophmeister 11y agoCommon libraries and frameworks are usually loaded from a CDN. These should stay in the browser's cache for some time.
- binarymax 11y agoOnly if everyone is using the same CDNs :)
- d33 11y agoYeah, but per domain. Unless you use something like cjdns, if you end up with static.yourlovelydomain.com, the resource's going to get downloaded from scratch at the first attempt. If we had checksums attached to resources, there'd be provably no point bothering to download them in many cases.
- tehbeard 11y agoThe problem is the quantity of CDNs on which jQuery for example can be found. For instance, your site might pull it in from cdnjs, while I have the one from ajax.googleapis.com already cached. I still have to go fetch your selected version.
- kevincox 11y agoI hear this argument a lot, and I very much disagree. Now you have browser vendors having to device which libraries are "popular" and shipping them in the initial download of the browser. It turns out that this technology already exists in a much better form. It's called cache. The problem is that almost everyone hosts their own version of jQuery. If everyone simply linked the "canonical" version of jQuery (the CDN link is right on their site) then requiring jQuery will be effectively free because it will be in everyone's cache. Also the cache is supported by all browsers with an elegant fallback. Instead of having to manually having to check if your user's browser has the resource you want preloaded you just like the URL and the best option will automatically be used. TL;DR Rather then turning this into a political issue stop bundling resources, modern protocols and intelligent parallel loading allow using the cache to stove this problem.
- deleted 11y ago[deleted]
- Lawtonfogle 11y ago> If everyone simply linked the "canonical" version of jQuery (the CDN link is right on their site) then requiring jQuery will be effectively free because it will be in everyone's cache. So create one massive target that needs to be breached to access massive numbers of websites around the world? Imagine if every Windows PC ran code from a single web page on startup every time they started up. Now imagine if anything could be put in that code and it would be ran. How big of a target would that be? While there are cases where the performance is worth using a CDN, there are plenty of reasons to not want to run foreign code. (Now maybe we could add some security, like generating a hash of the code on the CDN and matching it with a value provided by the website and only running the code if the hashes matched. But there are still business risks even with that.)
- eertami 11y agoThe solution to this is including a checksum with the link to the file, and if the checksum doesn't match, don't load the file. See https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity https://developer.mozilla.org/en-US/docs/Web/Security/Subres... though it isn't universally supported yet.
- JustSomeNobody 11y agoWe absolutely, most certainly, should NOT ship libraries with browsers. This is a horrible idea. Browser vendors would then have too much influence on development libraries.
- mod 11y agoIt could be a 'use the default or link your own' situation, which then wouldn't influence a whole lot. But I agree, overall.
- LeoNatan25 11y agoIn this case, very very little would change. People would still link their own, as they do now.
- JustSomeNobody 11y agoOr worse, people would use the buggy, out of date default.
- delan 11y ago“We absolutely, most certainly, should NOT ship libraries with operating systems.”
- ArkyBeagle 11y agoThere used to be a distinction between browsers and operating systems.
- JustSomeNobody 11y agoPretty sure there still is.
- mindcrime 11y agoIt's getting pretty hard to tell.
- rmc 11y ago> if pretty much every website uses jQuery, perhaps we should ship jQuery with the web browser? There's a firefox plugin that does just that! DecentralEyes - https://addons.mozilla.org/en-US/firefox/addon/decentraleyes/ https://addons.mozilla.org/en-US/firefox/addon/decentraleyes... Although mostly for privacy reasons, so google doesn't know all the sites you visit.
- douche 11y agoHmmmm, or javascript could be standardized on something that isn't a barely-working kludge with no batteries included? If something like jQuery or Lodash is basically table-stakes for doing anything really worthwhile, then just maybe that de facto standard should be made de jure.
- achairapart 11y agoWhy only jQuery, anyway? What if browsers shipped with a repository instead of a cache? Download once, stay forever.
- lostgame 11y agoIsn't this what the '.min' versions of these is for? jquery-2.2.3.min.js is only 86KB for me. For the amount of functionality it adds, sure seems like a sweet deal. Part of the problem (IMHO) is the growing requirement for larger, alpha-channel-using image formats like PNG, that then need to be expressed in a Retina format - I mean, shit looks terrible on my retina MacBook Pro that isn't properly Retina formatted. (Here's looking at you, Unity3D...even the current beta which supports Retina displays is extremely unstable and half the graphics (even stupid buttons on the UI) are still SD...) With bandwidth costs declining [1] and basic RAM increasing [2] is there a particular reason a Web application should be much smaller than a typical desktop application? We have caches for a reason. [1] http://www.networkworld.com/article/2187538/tech-primers/exponential-bandwidth-growth-and-cost-declines.html http://www.networkworld.com/article/2187538/tech-primers/exp... [2] http://en.yibada.com/articles/118394/20160422/macbook-air-is-not-dead-yet-13-inch-macbook-air-now-have-8gb-of-ram-as-standard-will-macbook-air-2016-materialize.htm http://en.yibada.com/articles/118394/20160422/macbook-air-is...