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.

有帮助吗?

解决方案

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.

其他提示

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.

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.

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.

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.

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/

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top