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)

experimental.webInspector.resources

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

See WebInspector API summary for general introduction to using WebInspector API.

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 webInspector.resources.getHAR() method returns entire HAR log, while webInspector.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 WebInspector 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:

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

API reference: experimental.webInspector.resources

Methods

getHAR

void experimental.webInspector.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

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

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

Parameters

resource
( Resource 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.

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.