2 ms·
Looks like MathJax is hosted on a CDN. Everything else, from css to other js files, is hosted alongside the HTML files. Seems a bit strange. I wonder why they
by codetrotter 3y ago
Looks like MathJax is hosted on a CDN. Everything else, from css to other js files, is hosted alongside the HTML files.
Seems a bit strange. I wonder why they chose to use a CDN for that one js file.
Perhaps because MathJax support is optional? https://rust-lang.github.io/mdBook/format/mathjax.html https://rust-lang.github.io/mdBook/format/mathjax.html
Even though the MathJax js file will in turn probably load more things hosted on the CDN. I don’t understand why they are not putting all of the MathJax files alongside the generated HTML files. So that one does not have to rely on any CDN.
- toastal 3y agoNow that I’m at my laptop I can see that you are correct on most things at least now being vendored–though it took me a while to find it since the scripts in the <body> like it’s last decade instead of in the <head> with async or defer attributes.
- singhrac 3y agoMaybe it’s because MathJax loading slow would delay rendering, and using a CDN-hosted MathJax increases the chance the content is cached? That’s usually why people use CDNs. It’s more important for MathJax than, say, interactive scripts, since it can cause rendering. I don’t think MathJax loads any additional files (I don’t remember seeing any additional network requests).
- toastal 3y agoWith first-party isolation being the standard for the last couple of years, there are no “shared caches”. A third-party CDNs might load a particular resource faster, but at the cost of user privacy & reliability. You can know, barring exceptional circumstances, that if your site loaded, it can load its own libraries. Look at the news of Cloudflare, Fastly, et al. going down and the ‘internet breaking’ because there’s been too much centralization and bad advice that all site’s need these sorts of ‘optimizations’.