-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Speculation Rules API #754
Comments
Oh, very cool to see this posted. As one of the spec maintainers and Chromium engineers on this feature, I think it's important to emphasize that speculation rules is a surface API that triggers (as of now) two larger features: prefetching, or prerendering. Those are specified in https://wicg.github.io/nav-speculation/prefetch.html and https://wicg.github.io/nav-speculation/prerendering.html. So just implementing the speculation rules spec by itself doesn't help; you'd need to implement one or both of those. If the parties involved don't want to accept everything into Interop 2025, I think accepting speculation rules + prefetching (omitting prerendering) would be a good compromise. As of October 1, speculation rules prefetch is used on ~12% of page loads, and this number is likely to go up a good chunk more as Cloudflare's Speed Brain deployment continues. Speculation rules prerender, although it's more dramatic and certainly well-loved among web developers, isn't seeing as-high adoption numbers. And working prefetch this year would be good groundwork if browsers wanted to tackle prerender the next year. |
@domenic I agree prefetch-only is a really good compromise on scope but one thought on this: would it be wise for them to treat prerender rules asif they were declared as prefetch? In my view, prerender is a stronger signal that a URL/href will be the next page (I know we have eagerness for that too) so they could depend on effectively downgrading prerender where it's not supported. If browsers weren't to do this, then we'll end up having to conditionally serve Speculation Rules to different browsers (possibly needing UA sniffing?), which is far from ideal. |
I agree that treating prerender as prefetch is reasonable. We've thought of doing that at times in Chromium (e.g. if limits are hit), but haven't as of yet. |
Description
The Speculation Rules API is designed to improve performance for future navigations. It targets document URLs rather than specific resource files, and so makes sense for multi-page applications (MPAs) rather than single-page applications (SPAs).
The Speculation Rules API provides an alternative to the widely-available feature. It provides many improvements over these technologies, along with a more expressive, configurable syntax for specifying which documents should be prefetched or prerendered.
Specification
https://wicg.github.io/nav-speculation/speculation-rules.html
Additional Signals
Webkit: WebKit/standards-positions#54
Mozilla: mozilla/standards-positions#620
Tests:
https://wpt.fyi/results/speculation-rules?label=master&label=experimental&aligned&q=speculation
Info about:
The text was updated successfully, but these errors were encountered: