How can I test service workers in offline mode locally? I mean, localhost doesn't need internet access so it just keeps fetching all the files. Can I simulate offline in Firefox or Chrome somehow so I can see what happens when caching fails, or other things go wrong?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
In Chrome, you can simulate being offline in the DevTools' Application
tab, inside the Service Workers
panel. You will see there a checkbox that says "Offline".
回答2:
Also, you could go to the Networks tab and perform the same action. Hope this helps :)