You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
paramName
( optional enumerated Type array of paramType )
Undocumented.
Description of this parameter from the json schema.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.
Parameters
  1. Properties
    1. propertyName
  2. Methods
    1. methodName
  3. Events
    1. eventName
  4. Types
    1. id

Google Chrome Extensions (Labs)

chrome.devtools.network API

chrome.devtools.network API

Use the chrome.devtools.network module to retrieve the information about network requests displayed by the Developer Tools in the Network panel.

See DevTools APIs summary for general introduction to using Developer Tools APIs.

Overview

Network requests information is represented in the HTTP Archive format (HAR). The description of HAR is outside of scope of this document, please refer to HAR v1.2 Specification.

In terms of HAR, the chrome.devtools.network.getHAR() method returns entire HAR log, while chrome.devtools.network.onRequestFinished event provides HAR entry as an argument to the event callback.

Note that request content is not provided as part of HAR for efficieny reasons. You may call request's getContent() method to retrieve content.

If the Developer Tools window is opened after the page is loaded, some requests may be missing in the array of entries returned by getHAR(). Reload the page to get all requests. In general, the list of requests returned by getHAR() should match that displayed in the Network panel.

Examples

The following code logs URLs of all images larger than 40KB as they are loaded:

chrome.devtools.network.onRequestFinished.addListener(
    function(request) {
      if (request.response.bodySize > 40*1024)
      chrome.experimental.devtools.console.addMessage(
          chrome.experimental.devtools.console.Severity.Warning,
          "Large image: " + request.request.url);
});

You can find more examples that use this API in Samples.

API reference: chrome.devtools.network

Methods

getHAR

void chrome.devtools.network.getHAR(, function callback)

Returns HAR log that contains all known network requests.

Parameters

callback
( Type array of function )
A function that receives the HAR log when the request completes.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

Returns

Callback function

The callback parameter should specify a function that looks like this:

If you specify the callback parameter, it should specify a function that looks like this:

function(object harLog) {...};
harLog
( Type array of object )
A HAR log. See HAR specification for details.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

This function was added in version . If you require this function, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

Events

onNavigated

chrome.devtools.network.onNavigated.addListener(function(string url) {...});

Fired when the inspected window navigates to a new page.

Listener parameters

url
( Type array of string )
URL of the new page.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

Extra parameters to addListener

Listener returns

onRequestFinished

chrome.devtools.network.onRequestFinished.addListener(function(Request request) {...});

Fired when a network request is finished and all request data are available.

Listener parameters

request
( Request array of paramType )
Description of a network request in the form of a HAR entry. See HAR specification for details.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

Extra parameters to addListener

Listener returns

Types

Request

paramName
( Type array of object )
Represents a network request for a document resource (script, image and so on). See HAR Specification for reference.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

Methods of Request

getContent

void request.getContent(, function callback)

Returns content of the response body.

Parameters

callback
( Type array of function )
A function that receives the response body when the request completes.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

Returns

Callback function

The callback parameter should specify a function that looks like this:

If you specify the callback parameter, it should specify a function that looks like this:

function(string content, string encoding) {...};
content
( Type array of string )
Content of the response body (potentially encoded).
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.
encoding
( Type array of string )
Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported.
This parameter was added in version . You must omit this parameter in earlier versions, and you may omit it in any version. If you require this parameter, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.

This function was added in version . If you require this function, the manifest key minimum_chrome_version can ensure that your extension won't be run in an earlier browser version.