3 ms·
If you're like me and were expecting the history of the digital.com domain, it's here: https://digital.com/about/#section-5 https://digital.com/about/#section-
by triangleman 6y ago
If you're like me and were expecting the history of the digital.com domain, it's here:
https://digital.com/about/#section-5 https://digital.com/about/#section-5
Now my question is, how did they make the site so fast? Checking my Firefox dev tools I'm seeing it's not even being requested on subsequent page views, just the cached version. How'd they do that?
- segfaultbuserr 6y ago> Now my question is, how did they make the site so fast? Simple. First, it uses a CDN (Cloudflare). Second, the site doesn't have 20 useless tracking scripts (I only see Google Analytics) or 10 useless pictures, the entire web page is only 446.37 KiB. The website is more than qualified to join the "1 MB Club" (recently discussed on HN, https://news.ycombinator.com/item?id=25151773 https://news.ycombinator.com/item?id=25151773). Third, all images are lazy-loaded (I see the WordPress plugin a3-lazy-load was used), so heavy images won't be downloaded until you need them. Fourth, it uses an aggressive caching policy: > Cache-Control: max-age=31536000, public > Expires: Sat, 04 Dec 2021 17:06:47 GMT So after the first click, 95% of the static resources will be cached and it significantly reduce the download size, which is a good practice (add version number to the file name, so you can always use aggressive caching). Although it's sad to see the website digital.com has become a web hosting marketing site, but at least the site owner did do her SEO homework by not creating yet another toxic webpage, I can consider it a positive (or at least, non-negative) contribution to the web.
- triangleman 6y agoOK So the Expires header is set to 15 minutes in the future. I think this is the secret sauce. I've never seen this before but I plan on trying it out heavily in the future. You don't even need to wait for a 304 content not modified, there's simply no request at all. So cool! edit: It seems like Expires is a bit older than cache-control, so not as relevant as I thought. I'm not seeing the 365 day cache control header you listed, it's anywhere from 5 minutes to 30 minutes. It's just weird to see a browser totally trust a cache and not even verify using "etag" or otherwise. I'll probably have to do a lot of trial and error to get this to happen but I really like it, because it feels so fast.
- segfaultbuserr 6y agoLook carefully, it's not 15 minutes, but an entire year, it expires in 2021. Nevertheless, any time in the future should work.
- triangleman 6y agoI mean look at the MDN page on cache control itself: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Ca... Now click away and click back. There will be a request and a 304. That's what I'm used to, not an instantaneous non-request.