Does Chrome have a "Work Offline" option?
Asked Answered
O

6

78

I'm trying to test out my fallback page in my html5 cache manifest. I'd rather not have to actually disconnect from the internet in order to do it. I've heard that it doesn't work quite right in Chrome, so I need to test it specifically. Does Chrome have the ability to work offline? I've searched through the settings and the available extensions, and I can't find anything.

Oldenburg answered 18/4, 2013 at 19:12 Comment(2)
Chrome does offer a way to view cached webpages, but unfortunately doesn't actually have a "Work Offline" option. There's an open feature request for the feature; you can vote for it if you like.Diluent
This question has also been answered on superuser.com: superuser.com/questions/459196/…Stendhal
M
74

It looks like Chrome now has this feature via Chrome developer tools (Ctrl-Shift-I). Click on the "Device Mode" icon at the top-left. Now, a device and network bandwidth and latency (or completely offline) can be simulated using the dropdowns at the top of the screen:

Device and Network Selection

The screenshot above is from Chrome Version 42.0.2311.60 beta (64-bit) on Linux.

NOTE: As of Apr 2015, unfortunately this does not affect Websocket connections, which continue to operate regardless of the Network setting. See https://code.google.com/p/chromium/issues/detail?id=423246.

UPDATE Sep 2021: It looks like the network settings will finally affect websocket connections as of Chrome 96. See the issue above for details.

Maidamaidan answered 29/3, 2015 at 5:38 Comment(7)
This doesn't quite work the way I'd expect. For instance I cannot access localhost. This is rather frustrating, because you may want to disable Chrome to make remote requests while working on a train or something.Plaint
The 'Offline' option does in fact block the websockets used by Meteor (DDP), FYI. Not sure when that started to be true.Cowry
@Plaint I think that's a feature, not a bug -- if I'm testing offline capabilities of my application hosted on localhost, I'd want Chrome to prevent access to it. However, it'd be nice if it was more configurable.Maidamaidan
I think this is much more faster: chrome.google.com/webstore/detail/offline-switcher/…Leverick
@DuongNguyen That extension still not work with websocketsUnchain
@Unchain Hopefully I have time time to work on that this week, release soon.Leverick
WebSockets not included when using connection throttlingFlier
A
25

Chrome has a flag called "Enable Show Saved Copy Button".
Find the flag by visiting the URL chrome://flags/#show-saved-copy

Enable Show Saved Copy Button
When a page fails to load, if a stale copy of the page exists in the browser cache, a button will be presented to allow the user to load that stale copy. The primary enabling choice puts the button in the most salient position on the error page; the secondary enabling choice puts it secondary to the reload button.

Note that this flag used to be called "Enable Offline Load Stale Button".

Chrome Offline Sample

Gmail also has an offline option. Gmail Offline is a Google Chrome app that lets you read and manage messages when you don’t have an Internet connection. You can even compose messages that will be sent when you’re back online.

Ancalin answered 18/4, 2013 at 19:26 Comment(1)
Chromium 87 does not seem to have the flag chrome://flags/#show-saved-copy, did they change the name?Spatterdash
G
6

Google chrome itself does not have this feature, however, I've found this page to do exactly just that with an extension.

http://techlogon.com/2013/01/25/how-to-work-offline-in-google-chrome/

It works by routing chrome traffic to a proxy that you specify where there are no proxy, and therefor will not receive any network traffic.

Gennie answered 9/12, 2013 at 14:11 Comment(2)
But this will not toggle navigator.onLine.Mendicant
@Mendicant navigator.onLine outputs false in offline modeFlier
L
4

Offline switcher is a new handy Chrome Extension to do the job quickly. You can toogle to switch between offline and online mode.

Chrome offline switcher

The add-on is simple, just to set Chrome proxy to an un-existing point.

Leverick answered 10/1, 2016 at 2:3 Comment(2)
so this will let me re-browse all pages I visited as long I can direcly click on links I have also previsouly visited? any idea how old pages this cache will keep?Metaphor
The link to this extension is broken now: does it still exist?Stendhal
D
0

As far as I am aware, Google Chrome does not have a work offline option, so disconnecting from the internet is the only way I can imagine doing it.

Dropper answered 18/4, 2013 at 19:17 Comment(4)
disconnecting from the internet will not help to viewing offline pages. Offline viewing is a must not a feature and Google chrome is a fault!Fascinator
@vkoves: is this still the case? Looking for a way to automate starting Chrome in an offline network profile.Stupa
@Stupa that can be done through the inspector. Open the Chrome inspector (F12) then go to "Network" and check the "Offline" checkbox. The approved answer says something similar.Dropper
@vkoves: thanks for your comment but what you have said is not an automated way of starting Chrome in an offline network profile. The steps you describe would be manual which is of no use in automated browser testing. I had hoped there would be a flag that Chrome would respect.Stupa
T
0

here are a few related chromium bugs

Devtools feature request: Toggle network throttling profiles with keyboard shortcuts https://code.google.com/p/chromium/issues/detail?id=511152

DevTools: Online/Offline events not being fired in device emulation https://code.google.com/p/chromium/issues/detail?id=422956

If you are using Firefox, the Work Offline extension is very handy https://addons.mozilla.org/en-GB/firefox/addon/work-offline/

Teague answered 6/10, 2015 at 4:12 Comment(1)
Old Fox does not need an extension, to make it offline go to File > work offline.Condone

© 2022 - 2024 — McMap. All rights reserved.