chrome.devtools.network Stay organized with collections Save and categorize content based on your preferences.
Description
Use thechrome.devtools.network API to retrieve the information about network requests displayed by the Developer Tools in the Network panel.
Network requests information is represented in the HTTP Archive format (HAR). The description ofHAR is outside of scope of this document, refer toHAR v1.2 Specification.
In terms of HAR, thechrome.devtools.network.getHAR() method returns entireHAR log, whilechrome.devtools.network.onRequestFinished event providesHAR entry as an argument to the eventcallback.
Note that request content is not provided as part of HAR for efficiency reasons. You may callrequest'sgetContent() method to retrieve content.
If the Developer Tools window is opened after the page is loaded, some requests may be missing inthe array of entries returned bygetHAR(). Reload the page to get all requests. In general, thelist of requests returned bygetHAR() should match that displayed in the Network panel.
SeeDevTools APIs summary for general introduction to using Developer Tools APIs.
Manifest
Examples
The following code logs URLs of all images larger than 40KB as they are loaded:
chrome.devtools.network.onRequestFinished.addListener(function(request){if(request.response.bodySize >40*1024){chrome.devtools.inspectedWindow.eval('console.log("Large image: " + unescape("'+escape(request.request.url)+'"))');}});To try this API, install thedevtools API examples from thechrome-extension-samplesrepository.
Types
Request
Represents a network request for a document resource (script, image and so on). See HAR Specification for reference.
Properties
- getContent
void
Returns content of the response body.
The
getContentfunction looks like:(callback: function) => {...}
- callback
function
The
callbackparameter looks like:(content: string, encoding: string) => void
- content
string
Content of the response body (potentially encoded).
- encoding
string
Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported.
Methods
getHAR()
chrome.devtools.network.getHAR(
callback: function,
): void
Returns HAR log that contains all known network requests.
Parameters
- callback
function
The
callbackparameter looks like:(harLog: object) => void
- harLog
object
A HAR log. See HAR specification for details.
Events
onNavigated
chrome.devtools.network.onNavigated.addListener(
callback: function,
)
Fired when the inspected window navigates to a new page.
Parameters
- callback
function
The
callbackparameter looks like:(url: string) => void
- url
string
onRequestFinished
chrome.devtools.network.onRequestFinished.addListener(
callback: function,
)
Fired when a network request is finished and all request data are available.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-11 UTC.