ElMassimo / iles

🏝 The joyful site generator
https://iles.pages.dev
MIT License
1.07k stars 31 forks source link

fix: prefetch support on Firefox #133

Closed titouanmathis closed 2 years ago

titouanmathis commented 2 years ago

Description 📖

I noticed that when enabling the turbo mode, links were not prefetched with Firefox.

Background 📜

It appears that Firefox does not support dynamically inserted prefetch links. This means that testing link.relList.supports('prefetch') will return true.

See the following Stack Overflow threads:

The Fix 🔨

This PR adds a test on the user-agent before testing the support of prefetch links, enabling the fallback prefetch strategy with fetch().

Screenshots 📷

I have no screenshots, let me know if you need some.

nx-cloud[bot] commented 2 years ago

Nx Cloud Report

CI is running for commit 167534c6ace6bae38f2f5189c3b476aae792a84f.

📂 Click to track the progress, see the status, the terminal output, and the build insights.


Sent with 💌 from NxCloud.

ouuan commented 2 years ago

My Firefox 101.0.1 does prefetch the links on https://the-vue-point-with-iles.netlify.app/. Are you sure it doesn't work on Firefox?

titouanmathis commented 2 years ago

Well, I don't know why, but the prefetch feature was disabled in my Firefox settings.

The feature is indeed working as expected, thanks for the information @ouuan!

ElMassimo commented 2 years ago

Thank you @titouanmathis for reporting 😊

Thanks @ouuan for taking a look at this one and replying 😃