Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.
Commands
Network.canClearBrowserCache
request: {
"id": <number>,
"method": "Network.canClearBrowserCache"
}
response: {
"id": <number>,
"error": <object>,
"result": {
"
result": <boolean>
}
}
Tells whether clearing browser cache is supported.
Returns
result
(
boolean
)
True if browser cache can be cleared.
Network.canClearBrowserCookies
request: {
"id": <number>,
"method": "Network.canClearBrowserCookies"
}
response: {
"id": <number>,
"error": <object>,
"result": {
"
result": <boolean>
}
}
Tells whether clearing browser cookies is supported.
Returns
result
(
boolean
)
True if browser cookies can be cleared.
Network.clearBrowserCache
request: {
"id": <number>,
"method": "Network.clearBrowserCache"
}
response: {
"id": <number>,
"error": <object>
}
Network.clearBrowserCookies
request: {
"id": <number>,
"method": "Network.clearBrowserCookies"
}
response: {
"id": <number>,
"error": <object>
}
Network.disable
request: {
"id": <number>,
"method": "Network.disable"
}
response: {
"id": <number>,
"error": <object>
}
Disables network tracking, prevents network events from being sent to the client.
Network.enable
request: {
"id": <number>,
"method": "Network.enable"
}
response: {
"id": <number>,
"error": <object>
}
Enables network tracking, network events will now be delivered to the client.
Network.getResponseBody
request: {
"id": <number>,
"method": "Network.getResponseBody",
"params": {
"
requestId": <
RequestId>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
"
body": <string>,
"
base64Encoded": <boolean>
}
}
Returns content served for the given request.
Parameters
requestId
Identifier of the network request to get content for.
Returns
body
(
string
)
Response body.
base64Encoded
(
boolean
)
True, if content was sent as base64.
Network.setCacheDisabled
request: {
"id": <number>,
"method": "Network.setCacheDisabled",
"params": {
"
cacheDisabled": <boolean>
}
}
response: {
"id": <number>,
"error": <object>
}
Toggles ignoring cache for each request. If true
, cache will not be used.
Parameters
cacheDisabled
(
boolean
)
Cache disabled state.
Network.setExtraHTTPHeaders
request: {
"id": <number>,
"method": "Network.setExtraHTTPHeaders",
"params": {
"
headers": <
Headers>
}
}
response: {
"id": <number>,
"error": <object>
}
Specifies whether to always send extra HTTP headers with the requests from this page.
Parameters
headers
Map with extra HTTP headers.
Network.setUserAgentOverride
request: {
"id": <number>,
"method": "Network.setUserAgentOverride",
"params": {
"
userAgent": <string>
}
}
response: {
"id": <number>,
"error": <object>
}
Allows overriding user agent with the given string.
Parameters
userAgent
(
string
)
User agent to use.
Notifications
Network.dataReceived
{
"method": "Network.dataReceived",
"params": {
"requestId": <
RequestId>,
"timestamp": <
Timestamp>,
"dataLength": <integer>,
"encodedDataLength": <integer>
}
}
Fired when data chunk was received over the network.
Parameters
requestId
Request identifier.
dataLength
(
integer
)
Data chunk length.
encodedDataLength
(
integer
)
Actual bytes received (might be less than dataLength for compressed encodings).
Network.loadingFailed
{
"method": "Network.loadingFailed",
"params": {
"requestId": <
RequestId>,
"timestamp": <
Timestamp>,
"errorText": <string>,
"canceled": <boolean>
}
}
Fired when HTTP request has failed to load.
Parameters
requestId
Request identifier.
errorText
(
string
)
User friendly error message.
canceled
(
optional
boolean
)
True if loading was canceled.
Network.loadingFinished
{
"method": "Network.loadingFinished",
"params": {
"requestId": <
RequestId>,
"timestamp": <
Timestamp>
}
}
Fired when HTTP request has finished loading.
Parameters
requestId
Request identifier.
Network.requestServedFromCache
{
"method": "Network.requestServedFromCache",
"params": {
"requestId": <
RequestId>
}
}
Fired if request ended up loading from cache.
Parameters
requestId
Request identifier.
Network.requestWillBeSent
Fired when page is about to send HTTP request.
Parameters
requestId
Request identifier.
loaderId
Loader identifier.
documentURL
(
string
)
URL of the document this request is loaded for.
initiator
Request initiator.
stackTrace
JavaScript stack trace upon issuing this request.
redirectResponse
Redirect response data.
Network.responseReceived
Fired when HTTP response is available.
Parameters
requestId
Request identifier.
loaderId
Loader identifier.
Types
CachedResource: object
bodySize
(
number
)
Cached response body size.
response
Cached response data.
type
Type of this resource.
url
(
string
)
Resource URL.
Initiator: object
lineNumber
(
optional
number
)
Initiator line number, set for Parser type only.
stackTrace
Initiator JavaScript stack trace, set for Script only.
type
(
enumerated
string
[
"other"
,
"parser"
,
"script"
]
)
Type of this initiator.
url
(
optional
string
)
Initiator URL, set for Parser type only.
Request: object
headers
HTTP request headers.
method
(
string
)
HTTP request method.
postData
(
optional
string
)
HTTP POST request data.
url
(
string
)
Request URL.
ResourceTiming: object
connectEnd
(
number
)
Connected to the remote host.
connectStart
(
number
)
Started connecting to the remote host.
dnsEnd
(
number
)
Finished DNS address resolve.
dnsStart
(
number
)
Started DNS address resolve.
proxyEnd
(
number
)
Finished resolving proxy.
proxyStart
(
number
)
Started resolving proxy.
receiveHeadersEnd
(
number
)
Finished receiving response headers.
requestTime
(
number
)
Timing's requestTime is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this requestTime.
sendEnd
(
number
)
Finished sending request.
sendStart
(
number
)
Started sending request.
sslEnd
(
number
)
Finished SSL handshake.
sslStart
(
number
)
Started SSL handshake.
Response: object
connectionId
(
number
)
Physical connection id that was actually used for this request.
connectionReused
(
boolean
)
Specifies whether physical connection was actually reused for this request.
fromDiskCache
(
optional
boolean
)
Specifies that the request was served from the disk cache.
headers
HTTP response headers.
headersText
(
optional
string
)
HTTP response headers text.
mimeType
(
string
)
Resource mimeType as determined by the browser.
requestHeaders
Refined HTTP request headers that were actually transmitted over the network.
requestHeadersText
(
optional
string
)
HTTP request headers text.
status
(
number
)
HTTP response status code.
statusText
(
string
)
HTTP response status text.
timing
Timing information for the given request.
url
(
string
)
Response URL.