Costa Michailidis
Costa Michailidis

Reputation: 8188

How to test service workers offline mode in localhost?

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?

Upvotes: 6

Views: 4467

Answers (2)

Nemanja Milosavljevic
Nemanja Milosavljevic

Reputation: 1291

Also, you could go to the Networks tab and perform the same action. Hope this helps :)

enter image description here

Upvotes: 1

Arnelle Balane
Arnelle Balane

Reputation: 5497

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".enter image description here

Upvotes: 5

Related Questions