I am trying to build an offline-data persistent web application with Service Workers. I managed to have it working on my laptop Chrome (51) and it loads the cached files and displays an offline message when I simulate being offline via the Chrome DevTools - Network tab. I uploaded the application to github to make sure it is available with https (https://mguardos.github.io/index.html)
However, when I try to test it with my Android Chrome (Nexus 5 - Android 6.0.1 - Chrome 51), the application loads fine when online, but if I set the plane mode on and reload the page, the browsers is not checking the service worker but displaying the offline message directly
"You are offline. Your devide is offline. Try: ... ERR_INTERNET_DISCONNECTED"
Is there any option that I have to enabled in my Android Chrome for Service workers to work?
Thanks for any tip
PS (edited): Same issue occurs with Opera 37 on Android 6.0.1. However, the Registration service happens properly for both Chrome and Opera in the background (validated via an alert upon the registration method is successfully completed)
PSS: The link above tries to be a very basic example of combining service workers with AppCache, to retrieve localStorage and IndexedDB data so any constructive critic would be very much appreciated on top of the original question
答案 0 :(得分:0)
Chrome中的问题似乎是需要将' /' 条目添加到要为服务工作者缓存的文件中。我添加了这个条目,我可以看到应用程序在我的Android下线时工作正常
然而,Opera的问题仍然存在,我甚至可以使用https://airhorner.com应用程序复制它
我会继续调查,并且可能会为Opera浏览器创建一个新问题,因为此问题已针对Chrome进行了解答