-
Notifications
You must be signed in to change notification settings - Fork 35
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
Notification of canceled prerendering? #162
Comments
My gut is that we should resist an explicit API, because it will give direct signal about what prefetches/prerenders are occurring (which might be leaky about that) and because it might create an incentive for developers to repeatedly retry in order to get as much of the device's scarce resources for themselves. I do think the browser should fallback internally. Ideally by default (prerender -> prefetch-with-subresources -> prefetch -> preconnect -> dns-prefetch), unless we have a reason not to. |
Having this fallback would be helpful since prerendering can be unsuccessful in browsers that still support the API. This often occurs without the user knowing it due to an extension, or simply if a user changes their browser preferences. Anecdotally, I've run into this case twice:
In both of these cases, Blog post on web.dev with more details from @tunetheweb In these cases, the best fallback I have found is to also add I've also found adding the url to both {
prerender: [
{
source: "list",
urls: [url],
},
],
prefetch: [
{
source: "list",
urls: [url],
},
],
} I think it's safe to assume that prefetching is desired on a failed attempt to prerender. I like @domenic's strategy outlined above. Having it be automatic would simplify the fallback instead of detecting it with an API. Edit: If this fallback isn't provided, what is the best way to fallback to prefetch? Is adding |
Thanks for this comment! At a minimum, it'll help us prioritize working on the automatic fallback, which I think is a no-brainer win. I'm also continuing to feel that a client-side detection API would be helpful, and we've been having some ongoing discussions about that. But as @jeremyroman mentions, it's tricky since it can encourage bad behaviors and can be tricky for privacy reasons with e.g. cross-site subresources on the prerendered page.
Additional prefetch value in speculation rules is the recommended approach. It has the advantages over |
Appreciate it, thanks for the guidance on the fallback! |
Consider a page
/A
which thinks it is very likely the user will navigate to/B
. The page wants to do as much as possible to ensure navigations to/B
is fast.One strategy a page might want is something like:
/B
. If this fails, or the prerendered browsing context is discarded.../B
with subresources. If this fails, or the prefetched resources are discarded, then.../B
(by itself). If this fails, or the prefetched document is discarded, then.../B
.Currently we have no mechanism to tell if a pre* fails or is discarded. So this is not really possible.
Should it be possible? If so, should it be via some mechanism that allows programmatic fallback? Or should it be more automatic via the browser?
The text was updated successfully, but these errors were encountered: