3 ms·
what I don't understand, is why browsers don't just include the core stuff like that in the actual build. There are like a dozen javascript frameworks that peo
by vaksel 15y ago
what I don't understand, is why browsers don't just include the core stuff like that in the actual build.
There are like a dozen javascript frameworks that people use...so why not keep the latest copy of jquery and YUI for example on the user's harddrive? Surely there is space for say, 2-3mb of different javascript libraries.
Then all you have to do is simply ignore the jquery/yui inclusion code when you render the page, and just load it from the harddrive instead.
No sweat for you, but your users and developers might actually find that when they use your browser they get a slightly faster experience.
- whichdan 15y agoSomeone in another thread (sorry, don't remember which) made a good point that including several frameworks by default would discourage people from trying new/novel/less popular frameworks. I think linking to the library from Google's CDN is a nice compromise since it greatly increases the chance that it'll already be cached.
- vaksel 15y agoI don't see why that would affect anything. You can always link to the framework, so at worst your user will find the site a few seconds slower to load. Then if there is adoption, you can always be included in the next build of the browser. All these frameworks tend to be tiny(i.e. jquery is huge, but is something like 30 kb), so nothing is stopping the browser from including all the possible frameworks on the harddrive.
- whichdan 15y agoI wonder whether enough developers would care about that extra few seconds on the initial view to make a noticeable impact?
- qeorge 15y ago100% agree. Have been wondering this for a while. One way to do it would be to include an extra attribute on the script tag with a SHA1 hash of the library. For example: <script type="text/javascript" signature="24bdd1c96c20c3943054c146340243ccf88eef9e" src="http://myserver.com/js/jquery-1.7.js" ></script> Old browsers would ignore the extra 'signature' attribute, while new browsers could check for that library in their included, pre-optimized list and skip the download if its found. Seems like it would solve a lot of problems at once without affecting backwards compatibility.