hubcap offline

Enable or disable the browser’s offline mode.

When to use

Simulate a complete network disconnection to test how a page behaves when offline, such as verifying service worker caching or offline fallback UI. Use throttle for slow-but-connected simulation rather than a full disconnect.

Usage

hubcap offline <true|false>

Arguments

ArgumentTypeRequiredDescription
valuebooleanYestrue to enable offline mode, false to disable it

Flags

None.

Output

FieldTypeDescription
offlinebooleanWhether offline mode is now active
{"offline":true}

Errors

ConditionExit codeStderr
Missing argument1usage: hubcap offline <true\|false>
Invalid argument1error: invalid value, use 'true' or 'false'
Chrome not connected2error: connecting to Chrome: ...
Timeout3error: timeout

Examples

Go offline:

hubcap offline true

Restore connectivity:

hubcap offline false

Go offline, reload the page, and check that the service worker serves cached content:

hubcap offline true && hubcap reload && hubcap waitload && hubcap text "#status"

See also

  • throttle - Simulate slow network conditions
  • block - Block specific URLs by pattern
  • network - Monitor network traffic