-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Prefetch not working in Firefox #12337
Comments
cannot reproduce this, I'm on a Mac M1 ff-astro.mov |
Fascinating.... I'm not sure what the difference is then, perhaps it's windows related? Recording.2024-10-29.180021.webm |
Apparently my prefetch was disabled in firefox closing this as it's not an astro issue clearly, though still don't know why the get requests are failing on my production site |
Might worth checking if it's related to https://docs.astro.build/en/guides/prefetch/#firefox. Also make sure there's no ad-blockers disabling prefetching too. |
It was exactly related to that! Lukas in the discord linked me the original issue where you worked on it Thank you so much for the input haha |
hey @JusticeMatthew, just to know, what cache-control headers did you add and how? My HTML files have For instance, the first page load, it prefetchs the links but only works on Chromium browsers (sometimes). And even on Chromium, once you start navigating through the page, seems like the previously prefetched pages are discarded and the browser will navigate to them without prefetching at all, like standard browser navigation. This is being solved if I set a value > 0 to cache-control to those HTML documents. Then it works great on pretty much every browser, But I don't think that would be a good idea to set cache-control to HTML documents? EDIT: also on "hover". Links are being prefetched only one time and never prefetched again unless the whole page is refreshed. This might be intended, but this would mean we have to set HTML files with cache-control to a value >0, preferable high enough for the expected navigation duration of the page. To sum this up:
Might be a good idea to add a check for the headers in Astro Router to re-prefetch pages when their cache expires, but this would only work on Chromium as Firefox throws a "NS_BINDING_ABORTED" due to, possibly, @bluwy would love to hear what are your thoughts on this, because the docs seem to assume Chrome and Firefox will handle this smoothly no matter what With
Could not test Safari. |
If you've set
I did want to try that, but the browser doesn't provide APIs to read that for prefetches or fetches. It's all managed by the browser itself. I'd wish there's a better DX to setup prefetching that works everywhere, but after research in the past this is the best I've found. |
Ah sorry, I interpreted I appreciate your feedback a lot! Even if a custom prefetching replace to browsers APIs could be done, I don't think it is even worth it given the increase in complexity and bugs. Using a value for |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
Firefox
Describe the Bug
Prefetches appear to not be happening in Firefox. This was first brought to my attention by discord member Matthias at which time I noticed it happening in my own deployed project
If you go to the minimal repro, open the preview in a new tab, and check the dev tools you will see under the network tab the prefetchs are successfully made in chrome but are nowhere to be found in firefox (despite the console saying it prefetched them) when hovering over the links.
What's the expected result?
I expect to see the fetch request happen in Firefox as you do in chrome. With the current behavior it appears the prefetch may not be happening at all
Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-q6tjrk?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: