14 KiB
Network
_Auto generated documentation for WebKit inspector
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
- enable
- disable
- setExtraHTTPHeaders
- getResponseBody
- canClearBrowserCache
- clearBrowserCache
- canClearBrowserCookies
- clearBrowserCookies
- setCacheDisabled
- loadResource
- Events
- requestWillBeSent
- requestServedFromCache
- responseReceived
- dataReceived
- loadingFinished
- loadingFailed
- requestServedFromMemoryCache
- webSocketWillSendHandshakeRequest
- webSocketHandshakeResponseReceived
- webSocketCreated
- webSocketClosed
- webSocketFrameReceived
- webSocketFrameError
- webSocketFrameSent
- Types
- LoaderId
- FrameId
- RequestId
- Timestamp
- Headers
- ResourceTiming
- Request
- Response
- WebSocketRequest
- WebSocketResponse
- WebSocketFrame
- CachedResource
- Initiator
Commands
Network.enable(callback)
Enables network tracking, network events will now be delivered to the client.
Parameters
callback ( function )
Results
error ( error )
Network.disable(callback)
Disables network tracking, prevents network events from being sent to the client.
Parameters
callback ( function )
Results
error ( error )
Network.setExtraHTTPHeaders(Headers, callback)
Specifies whether to always send extra HTTP headers with the requests from this page.
Parameters
headers ( Headers )
Map with extra HTTP headers.
callback ( function )
Results
error ( error )
Network.getResponseBody(RequestId, callback)
Returns content served for the given request.
Parameters
requestId ( RequestId )
Identifier of the network request to get content for.
callback ( function )
Results
error ( error )
body ( string )
Response body.
base64Encoded ( boolean )
True, if content was sent as base64.
Network.canClearBrowserCache(callback)
Tells whether clearing browser cache is supported.
Parameters
callback ( function )
Results
error ( error )
result ( boolean )
True if browser cache can be cleared.
Network.clearBrowserCache(callback)
Clears browser cache.
Parameters
callback ( function )
Results
error ( error )
Network.canClearBrowserCookies(callback)
Tells whether clearing browser cookies is supported.
Parameters
callback ( function )
Results
error ( error )
result ( boolean )
True if browser cookies can be cleared.
Network.clearBrowserCookies(callback)
Clears browser cookies.
Parameters
callback ( function )
Results
error ( error )
Network.setCacheDisabled(cacheDisabled, callback)
Toggles ignoring cache for each request. If true, cache will not be used.
Parameters
cacheDisabled ( boolean )
Cache disabled state.
callback ( function )
Results
error ( error )
Network.loadResource(FrameId, url, callback)
Loads a resource in the context of a frame on the inspected page without cross origin checks.
Parameters
frameId ( FrameId )
Frame to load the resource from.
url ( string )
URL of the resource to load.
callback ( function )
Results
error ( error )
content ( string )
Resource content.
mimeType ( string )
Resource mimeType.
status ( number )
HTTP response status code.
Events
Event: requestWillBeSent
Fired when page is about to send HTTP request.
Results
requestId ( RequestId )
Request identifier.
frameId ( FrameId )
Frame identifier.
loaderId ( LoaderId )
Loader identifier.
documentURL ( string )
URL of the document this request is loaded for.
request ( Request )
Request data.
timestamp ( Timestamp )
Timestamp.
initiator ( Initiator )
Request initiator.
redirectResponse ( optional Response )
Redirect response data.
type ( optional Page.ResourceType )
Resource type.
Event: requestServedFromCache
Fired if request ended up loading from cache.
Results
requestId ( RequestId )
Request identifier.
Event: responseReceived
Fired when HTTP response is available.
Results
requestId ( RequestId )
Request identifier.
frameId ( FrameId )
Frame identifier.
loaderId ( LoaderId )
Loader identifier.
timestamp ( Timestamp )
Timestamp.
type ( Page.ResourceType )
Resource type.
response ( Response )
Response data.
Event: dataReceived
Fired when data chunk was received over the network.
Results
requestId ( RequestId )
Request identifier.
timestamp ( Timestamp )
Timestamp.
dataLength ( integer )
Data chunk length.
encodedDataLength ( integer )
Actual bytes received (might be less than dataLength for compressed encodings).
Event: loadingFinished
Fired when HTTP request has finished loading.
Results
requestId ( RequestId )
Request identifier.
timestamp ( Timestamp )
Timestamp.
sourceMapURL ( optional string )
URL of source map associated with this resource (if any).
Event: loadingFailed
Fired when HTTP request has failed to load.
Results
requestId ( RequestId )
Request identifier.
timestamp ( Timestamp )
Timestamp.
errorText ( string )
User friendly error message.
canceled ( optional boolean )
True if loading was canceled.
Event: requestServedFromMemoryCache
Fired when HTTP request has been served from memory cache.
Results
requestId ( RequestId )
Request identifier.
frameId ( FrameId )
Frame identifier.
loaderId ( LoaderId )
Loader identifier.
documentURL ( string )
URL of the document this request is loaded for.
timestamp ( Timestamp )
Timestamp.
initiator ( Initiator )
Request initiator.
resource ( CachedResource )
Cached resource data.
Event: webSocketWillSendHandshakeRequest
Fired when WebSocket is about to initiate handshake.
Results
requestId ( RequestId )
Request identifier.
timestamp ( Timestamp )
Timestamp.
request ( WebSocketRequest )
WebSocket request data.
Event: webSocketHandshakeResponseReceived
Fired when WebSocket handshake response becomes available.
Results
requestId ( RequestId )
Request identifier.
timestamp ( Timestamp )
Timestamp.
response ( WebSocketResponse )
WebSocket response data.
Event: webSocketCreated
Fired upon WebSocket creation.
Results
requestId ( RequestId )
Request identifier.
url ( string )
WebSocket request URL.
Event: webSocketClosed
Fired when WebSocket is closed.
Results
requestId ( RequestId )
Request identifier.
timestamp ( Timestamp )
Timestamp.
Event: webSocketFrameReceived
Fired when WebSocket frame is received.
Results
requestId ( RequestId )
Request identifier.
timestamp ( Timestamp )
Timestamp.
response ( WebSocketFrame )
WebSocket response data.
Event: webSocketFrameError
Fired when WebSocket frame error occurs.
Results
requestId ( RequestId )
Request identifier.
timestamp ( Timestamp )
Timestamp.
errorMessage ( string )
WebSocket frame error message.
Event: webSocketFrameSent
Fired when WebSocket frame is sent.
Results
requestId ( RequestId )
Request identifier.
timestamp ( Timestamp )
Timestamp.
response ( WebSocketFrame )
WebSocket response data.
Types
Class: LoaderId
Type: string
Unique loader identifier.
Class: FrameId
Type: string
Unique frame identifier.
Class: RequestId
Type: string
Unique request identifier.
Class: Timestamp
Type: number
Number of seconds since epoch.
Class: Headers
Type: object
Request / response headers as keys / values of JSON object.
Class: ResourceTiming
Type: object
Timing information for the request.
Properties
navigationStart ( number )
Timing's navigationStart is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this navigationStart.
domainLookupStart ( number )
Started DNS address resolve.
domainLookupEnd ( number )
Finished DNS address resolve.
connectStart ( number )
Started connecting to the remote host.
connectEnd ( number )
Connected to the remote host.
secureConnectionStart ( number )
Started SSL handshake.
requestStart ( number )
Started sending request.
responseStart ( number )
Started receiving response headers.
Class: Request
Type: object
HTTP request data.
Properties
url ( string )
Request URL.
method ( string )
HTTP request method.
headers ( Headers )
HTTP request headers.
postData ( optional string )
HTTP POST request data.
Class: Response
Type: object
HTTP response data.
Properties
url ( string )
Response URL. This URL can be different from CachedResource.url in case of redirect.
status ( number )
HTTP response status code.
statusText ( string )
HTTP response status text.
headers ( Headers )
HTTP response headers.
headersText ( optional string )
HTTP response headers text.
mimeType ( string )
Resource mimeType as determined by the browser.
requestHeaders ( optional Headers )
Refined HTTP request headers that were actually transmitted over the network.
requestHeadersText ( optional string )
HTTP request headers text.
fromDiskCache ( optional boolean )
Specifies that the request was served from the disk cache.
timing ( optional ResourceTiming )
Timing information for the given request.
Class: WebSocketRequest
Type: object
WebSocket request data.
Properties
headers ( Headers )
HTTP response headers.
Class: WebSocketResponse
Type: object
WebSocket response data.
Properties
status ( number )
HTTP response status code.
statusText ( string )
HTTP response status text.
headers ( Headers )
HTTP response headers.
Class: WebSocketFrame
Type: object
WebSocket frame data.
Properties
opcode ( number )
WebSocket frame opcode.
mask ( boolean )
WebSocket frame mask.
payloadData ( string )
WebSocket frame payload data.
Class: CachedResource
Type: object
Information about the cached resource.
Properties
url ( string )
Resource URL. This is the url of the original network request.
type ( Page.ResourceType )
Type of this resource.
response ( optional Response )
Cached response data.
bodySize ( number )
Cached response body size.
sourceMapURL ( optional string )
URL of source map associated with this resource (if any).
Class: Initiator
Type: object
Information about the request initiator.
Properties
type ( string enumerated ["parser","script","other"] )
Type of this initiator.
stackTrace ( optional Console.StackTrace )
Initiator JavaScript stack trace, set for Script only.
url ( optional string )
Initiator URL, set for Parser type only.
lineNumber ( optional number )
Initiator line number, set for Parser type only.