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?
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?
Share Improve this question asked Apr 3, 2017 at 22:42 Costa MichailidisCosta Michailidis 8,21818 gold badges84 silver badges137 bronze badges 2- Hmm.. discovered a 'work offline' option in firefox. Click preferences > Developer, and then all the way at the bottom is work offline. That worked.... okay, that didn't work. It worked for css changes, but not html files. Very strange. – Costa Michailidis Commented Apr 3, 2017 at 22:51
- 1 The work offline option didn't work for me because localhost was still available with Apache. I turned off Apache and then i was able to test the offline version of the page without any problems. – Andres SK Commented Mar 29, 2018 at 17:27
2 Answers
Reset to default 5In 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".
Also, you could go to the Networks tab and perform the same action. Hope this helps :)