4 ms·
>If only jQuery was modular and didn't require to load 300 or 400 Kb of code. JQuery's own site says the library is 30 to 40 Kb, not 300 or 400. The minified J
by krapp 4y ago
>If only jQuery was modular and didn't require to load 300 or 400 Kb of code.
JQuery's own site says the library is 30 to 40 Kb, not 300 or 400. The minified JS file I downloaded of the latest version is 87 Kb, so I assume the rest would be taken care of with zip headers.
Are people routinely serving the uncompressed version of the library?
- mejutoco 4y agoAgree. Plus one can use a cdn to increase the chances of the library being already downloaded.
- youngtaff 4y agoWon’t work Browser caches are partitioned by origin so if a.com and b.com both use jquery from c.com then two copies of jquery will be cached one with a key of a.com/c.com and another with b.com/c.com
- exodust 4y agoHave browsers always done this? I thought and heard that using a JS library from CDN is beneficial when users already have that same cached JS library from visiting other sites. But you're saying that's not a thing? So what's the benefit of using a CDN for jquery then?
- recursive 4y agoNo, they have not always done this. But the supposed caching benefits of CDNs have always been overstated.
- youngtaff 4y agoSafari has done it for a long time, Chrome and the others more recently. Even back in 2012 people were raising the question of whether shared caching of libraries from the public JS CDNs was effective — due to too many different versions in use, and content being evicted from the browser cache sooner than most expected
- exodust 4y agoOk thanks for explaining. I wasn't aware of the changes. I don't mind at all, it just means I'll avoid using CDN hosted JS libraries from now on.
- eastbound 4y agoBrowsers have started doing this because it’s a security issue. If a some libs load fast, the app can fingerprint or guess which website you were on before.
- codedokode 4y agoIt seems that you are right, the 300Kb number is about an uncompressed version. Still it is very large and includes lot of code I don't need.