You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use instantpage.js on my blog that has a service-worker to implement offline functionality. In case a user accesses my website offline I receive a net::ERR_INTERNET_DISCONNECTED error in the preload function when instantpage.js tries to prefetch a resource.
Expected
As a website owner, I want to only prefetch URLs when I am online, so that I am not getting network errors when my site is offline or served by a service-worker.
Potential solution
To show a potential solution I created a pull request that implements a guard in the preload function to disable preload when the navigator is offline (https://developer.mozilla.org/de/docs/Web/API/NavigatorOnLine/onLine). I don't know if it is be possible to prefetch directly from the service-worker cache in this case, but I guess prefetching only makes sense when you are online anyway (of caused to be discussed!).
I am a part time developer so the adjustment should be deeply checked and tested!
KR and thanks for making and maintaining this awesome script!
The text was updated successfully, but these errors were encountered:
Issue
I use instantpage.js on my blog that has a service-worker to implement offline functionality. In case a user accesses my website offline I receive a
net::ERR_INTERNET_DISCONNECTED
error in thepreload
function wheninstantpage.js
tries to prefetch a resource.Expected
As a website owner, I want to only prefetch URLs when I am online, so that I am not getting network errors when my site is offline or served by a service-worker.
Potential solution
To show a potential solution I created a pull request that implements a guard in the preload function to disable preload when the navigator is offline (https://developer.mozilla.org/de/docs/Web/API/NavigatorOnLine/onLine). I don't know if it is be possible to prefetch directly from the service-worker cache in this case, but I guess prefetching only makes sense when you are online anyway (of caused to be discussed!).
I am a part time developer so the adjustment should be deeply checked and tested!
KR and thanks for making and maintaining this awesome script!
The text was updated successfully, but these errors were encountered: