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

Google Chrome Extensions (Labs)

chrome.experimental.devtools.resources

For information on how to use experimental APIs, see the chrome.experimental.* APIs page.

Use the chrome.experimental.devtools.resources module to retrieve the information about network resources displayed by DevTools' Network panel.

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

Notes

Network resource information is represented in 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.experimental.devtools.resources.getHAR() method returns entire HAR log, while chrome.experimental.devtools.resources.onFinish event provides HAR entry as an argument to the event callback.

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

Some resources may be missing in the array of entries returned by getHAR() in case Developer Tools window was opened after the page was loaded — reload the page to get all resources. In general, the list of resources returned by getHAR() should match that displayed by the Network panel.

Examples

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

chrome.experimental.devtools.resources.onFinished.addListener(function(resource) {
  if (resource.response.bodySize > 40*1024)
    experimental.chrome.devtools.log("Large image: " + resource.request.url);
});

Examples

You can find examples that use this API in Samples.

API reference: chrome.experimental.devtools.resources

Methods

getHAR

void chrome.experimental.devtools.resources.getHAR(, function callback)

Returns HAR archive that contains all known resource objects.

Parameters

callback
( Type array of function )
A function that is called upon request completion.
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 har) {...};
har
( Type array of object )
A HAR archieve. 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

onFinished

chrome.experimental.devtools.resources.onFinished.addListener(function(Resource resource) {...});

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

Listener parameters

resource
( Resource array of paramType )
Description of a newly finished resource 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

onNavigated

chrome.experimental.devtools.resources.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

Types

Resource

paramName
( Type array of object )
Represents a resource (document, script, image etc). 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 Resource

getContent

void resource.getContent(, function callback)

Returns resource content.

Parameters

callback
( Type array of function )
A function that is called upon request completion.
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 )
Resource content (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 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.