← Back to Network domain

Network.overrideNetworkState

Override the state of navigator.onLine and navigator.connection.

Domain: Network experimental

Parameters

NameTypeDescription
offlinebooleanTrue to emulate internet disconnection.
latencynumberMinimum latency from request sent to response headers received (ms).
downloadThroughputnumberMaximal aggregated download throughput (bytes/sec). -1 disables download throttling.
uploadThroughputnumberMaximal aggregated upload throughput (bytes/sec). -1 disables upload throttling.
connectionType (optional)ConnectionTypeConnection type if known.

Example Request

{
  "id": 1,
  "method": "Network.overrideNetworkState",
  "params": {
    "offline": true,
    "latency": 1.0,
    "downloadThroughput": 1.0,
    "uploadThroughput": 1.0
  }
}

Example Response

{
  "id": 1,
  "result": {}
}

Usage in Node.js

const result = await send('Network.overrideNetworkState', {"offline": true, "latency": 1.0, "downloadThroughput": 1.0, "uploadThroughput": 1.0});
console.log(result);