How can I access HAR files generated from the activity of a web page in a browser tab and access the request-response size data from the HAR files using pure JavaScript or web APIs?
I referred the following source but don't know the exact way: http://www.softwareishard.com/blog/har-12-spec/#postData.
How can I use the following line of code mentioned there?
var totalSize = entry.response.headersSize + entry.response.bodySize;
Asked
Active
Viewed 715 times
0

Aditya Tiwari
- 13
- 5
1 Answers
0
There is no Web API for that. You can, however, construct a HAR file by logging calls to fetch()
(and XHR) in the main thread, but that would not include fetches initiated by other means (e.g. <img>
). The way to solve that is to register a service worker and logging every "fetch"
event instead.
If you just want to get a HAR file programmatically, you can use something like Puppeteer and puppeteer-har.

D. Pardal
- 6,173
- 1
- 17
- 37