docs.rodeo

MDN Web Docs mirror

devtools.network.getHAR()

{{AddonSidebar}} 

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

This is an asynchronous function that returns a Promise.

Syntax

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.

Browser compatibility

{{Compat}} 

Examples

Log the URLs of requests contained in the HAR log:

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

{{WebExtExamples}} 

[!NOTE] This API is based on Chromium’s chrome.devtools.network API.

In this article

View on MDN