I have an HTML5 application that requires offline support. I am using a local Apache server for the application, and am trying to figure out what the best way is to simulate offline mode (currently, in Firefox I disable my Air-Port to simulate offline mode, but this is a pain). Any suggestions? I am open to using other browsers if a method exists that doesn't require turning off my Internet.
4 Answers
For Firefox
☰ (hamburger menu)->More->Work Offline
Google Chrome doesn't appear to have this feature
Edit: Also, another alternative is slightly more time-consuming to setup in the beginning but might be worth it. For Firefox/Chrome there should be proxy plugins, set up a fake/bad profile for each so that you proxy to something that doesn't exist... like 127.0.0.20:8080. After that you can switch the proxy setting on and off to emulate a full-stack test.
-
4
-
@ClayNichols Chrome's priorities are somewhat skewed away from stuff like this, atleast that's how I see things considering the number of years the bug report for managed error pages has been going.– DavidMay 22, 2012 at 17:33
-
I don't think this works. I have service worker, so my page should work offline. But instead, I get an error say firefox can not browse the web.– BigNameMay 27, 2017 at 3:49
-
7Chrome now has an "Offline" option in the Dev Tools, under Network tab. I was searching for similar on Firefox and I couldn't find. The File -> Work Offline is exactly what I needed!!– NunoApr 17, 2018 at 22:45
-
As @Nuno mentioned, or using Devtools-> device toolbar (second icon on top left, near to "Elements" tab) -> online/offline dropdown– chotkosFeb 13, 2020 at 9:25
The other answers are out of date. The only place this appears in Firefox v92 is under File > Work Offline
.
The File
menu can be accessed in the top left of Firefox by pressing the ALT
key.
-
2
-
1
-
NOTE: It appears that connections to 'localhost' (e.g., localhost:8080) aren't disabled when you select "Work Offline" — which makes it hard to test Offline Mode when you're developing a PWA locally (and haven't set it up to run on an HTTPS server yet...) Feb 3 at 16:31
In Chrome you can open developer tools switch to the network tab and set throttling to offline
For Firefox, from the ☰ (hamburger menu), choose Web Developer > Work Offline.
For Chrome, open DevTools and select the Network panel. Throttling is set to Online (Disabled) by default. From the dropdown menu, you can choose presets Fast 3G and Slow 3G, but to simulate Offline Mode, you want to choose Offline.
-
1
-