Created attachment 334133 [details]
Screenshot showing a bad state
Filing this on behalf of Jeffrey Posnick
Tech Preview 49.
Uses sw-precache  for static assets, but not navigations.
- Offline-fallback logic works in Chrome, but never appears to be triggered when navigating offline to https://www.treebo.com. [JS]
- Once, I was able to get into a state in which the request for the HTML (which isn't served from the cache, but does pass through the SW) was only partially successful. I had to clear out the SW and caches using Safari's Privacy settings to get back into a functional state. [SCREENSHOT]
Someone needs to explain to me how to trigger the offline logic in Chrome. With the latest Chrome Canary, I tried:
1. Load https://www.treebo.com
2. Wait ~10 seconds
3. Reload https://www.treebo.com
4. Wait ~10 seconds
5. Turn off Wifi on my laptop
6. Reload https://www.treebo.com / Or Go to https://www.treebo.com in a new tab
-> I get a generic error about having no internet connection
Behavior is similar on both Chrome and Safari Technology Preview 49.
Treebo is down for me (403)...
I'll try again over the weekend and see if Jeffrey is back from vacation.
After looking into it some more, it seems like Treebo has a customized service worker that it uses for "mobile" user agents. That service worker script imports https://static.treebo.com/rodimus/build/client/offline/offline.00000002.js which in turn handles the custom offline page for failed navigations.
So, the offline fallback wasn't working in Safari TP 49 when I tested because I was using a "desktop" user agent, and the offline fallback script wasn't imported.
I just upgraded to Safari TP 50 and explicitly switched my user agent emulation to iOS 11.0 - iPhone, and I was served the service worker script with the extra offline fallback logic. It works as expected when I disabled my internet connection and navigated to the page.
I'm not readily able to reproduce the second issue, as it only cropped up once while testing with TP 49. It might have been due to a bug in Safari TP 49 that has since been fixed in Safari TP 50.
Marking as resolved as per last comment.