experimental.webInspector.resources
For information on how to use experimental APIs, see the chrome.experimental.* APIs page.
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
Properties
getLastError
chrome.extensionlastError
Methods
getHAR
void
experimental.webInspector.resources.getHAR(, function
callback)
Undocumented.
Returns HAR archive that contains all known resource objects.
Parameters
-
callback
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- 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
(
optional
enumerated
Type
array of
object
)
-
Undocumented.
- 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) {...});
Undocumented.
Fired when a resource request is finished and all resource data are available.
Parameters
-
resource
(
optional
enumerated
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
(
optional
enumerated
Type
array of
object
)
Undocumented.
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)
Undocumented.
Returns resource content.
Parameters
-
callback
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- 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
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
- 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
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
- 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.