staticSearch
staticSearch copied to clipboard
Consider adding preload headers to the search page
While the search page is already quite fast, we could make it even faster by using the preload hint for browsers:
https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content
When we build the search page, we could add preloads for the required set of resources so that by the time the JS kicks in, those resources would be cached and staticSearch could instantiate a bit faster.
It looks like all major browsers have supported it for a while (https://caniuse.com/link-rel-preload) and I can't imagine there being any major downsides, but we'd need to test, of course.
I'm going to bump this to blue sky—it's purely an enhancement that could be interesting (but is not at all necessary).
I agree it's blue sky, but when there's time I'd definitely like to try it and see whether it makes any difference. The tricky bit is figuring out whether it'll interfere with requests for the same resources made using fetch(); if we don't explicitly fetch things, we won't know when they're available, but if we initiate a fetch request while the browser is already getting the resource as a preload, we'll be depending on the browser being clever enough to notice that and optimize around the conflict.