Closed smoak closed 4 months ago
On first load of your site, I don't see a service worker registered. It isn't until I refresh that your service worker loads and is activated. Since it is a bot looking for your SW and it's not loading on the first pass, this could be why your SW isn't being detected.
Update: I have been playing with this for a few more minutes and the behavior is a bit different across browsers and even in incognito. Going to get some more people on the team to mess around with this to double check.
@smoak @Jaylyn-Barbee getting same behaviour in Edge and Kiwi Mobile. After 5-6 refreshes I have finally got the SW in Edge. Clean website data and check your app logic. In Chrome I can't reproduce this... Try to not use windows load event at all in sw registration. Update: yeah, it's definitely a problem in this event. It's triggers before this code and never executes.
As this is an issue in yalls service worker, I am going to close this issue for now, but please feel free to open a new issue if you make our suggested changes and still hit issues. Thanks for using PWABuilder!
Try to not use windows load event at all in sw registration.
@khmyznikov Can you help me understand why I shouldn't use this? The workbox docs suggests waiting until the page is fully loaded before registering the service worker
Further documentation suggests this as well:
If a service worker precaches anything, then the time at which it's registered matters. Service workers are often registered using inline Githubissues.
Githubissues is a development platform for aggregating issues.
What happened?
I ran the report card, but it says "PWABuilder has analyzed your site and did not find a Service Worker."
However, there is a service worker registered. Chrome Dev Tools and Firefox Dev Tools show a service worker running and activated.
Chrome dev tools:
Firefox dev tools:
How do we reproduce the behavior?
What do you expect to happen?
For the service worker to be detected.
What environment were you using?
OS: Linux Kernel: 6.6.18-1-lts x86_64 Browser: chromium 122.0.6261.69 AND firefox 123.0 Device: ThinkPad X1 Yoga 3rd Gen CPU: quad core Intel Core i7-8650U
Additional context
No response