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.
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.
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);
});
You can find examples that use this API in Samples.