devtools.network.getHAR()

Get a HAR log for the page loaded in the current tab.

This is an asynchronous function that returns a Promise.

Syntax

js
let getting = browser.devtools.network.getHAR()

Parameters

None.

Return value

A Promise that will be fulfilled with an object containing the HAR log for the current tab. For details of what the log object contains, refer to the HAR specification.

Examples

Log the URLs of requests contained in the HAR log:

js
async function logRequests() {
  let harLog = await browser.devtools.network.getHAR();
  console.log(`HAR version: ${harLog.version}`);
  for (const entry of harLog.entries) {
    console.log(entry.request.url);
  }
}

logRequestsButton.addEventListener("click", logRequests);

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
getHAR
Chrome – Full support
Chrome 18 (Release date: 2012-03-28)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – Full support
Firefox 60 (Release date: 2018-05-09)
footnote
footnote The returned HAR log will be empty unless the user has previously activated the browser's network panel at least once.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

Note: This API is based on Chromium's chrome.devtools.network API.