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.
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.
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); });