HTTP Archive(HAR) File

HAR stands for http archive. This is a file format used to capture network/API information between browsers and web/application server.

This is also used for identifying performance issues such as slow load times and page  rendering problems etc.

The HAR file information is stored in JSON format which means in order to visualize the details we need some tool which have view the Jason file inside HAR. We say such tools as HAR viewer.

Steps to proceed with HAR file.

1.Capture the HAR file details in browsers

2.Save the HAR file

3.Analyze HAR file

1.Capture the HAR file details in browsers

Har file can be capture using any of the browser such as Firefox , chrome etc.

The file can be capture by using below methods

1.Via web developer tool

2.Right click on browser and go to inspect

Lets take an example of website meratech.in The moment we load meratech.in the browser send multiple query/API to this sites to load and gather details like static/dynamic pages, word press version, different images etc.

Now lets take an example to demonstrate the HAR file dump and check the API that being triggered in background when we load any page.

In order to capture the HAR file we need to check on network tab under developer option or just right click on the website and go to inspect and click on network tab.

I am using meratech.in to capture the backend API details while loading.

You can see the total number of request for opening www.meratech.in is 89.You can check the individual page loading time for each query.

You can see individually the time taken to load each images/url

2.Save the HAR file

Once the required details captured. Save the HAR file to further analyze it using browser or HAR file viewer. Save all the details as HAR file by clicking on gear icon and then save all as HAR. Another method to save is to right click on HAR output and save as HAR

3.Analyze HAR file

The Har file can be analyze using browser and HAR file viewer. Just google HAR file viewer for analysis

a.Using HAR file viewer

b.Using browser

I have saved this file named as meratech.in.har

a.Using HAR file viewer

I am using one of the HAR file viewer named http://www.softwareishard.com/har/viewer/

You can either copy the content of meratech.in.har file and paste here or you can drag the file and paste here.

I am dragging my HAR file here. Lets see the output. We can see the output is in more readable format.

And we can see the API request in this case , expand the API to see what actually inside the query.

b.Using browser.

In this case we can import the same HAR file in Browser here firefox and read the content.

However the imported file on browser do not have very good experience as readable.

Summary:

1.HAR file used to troubleshoot network and performance related issue between browser and application server.
2.HAR file contains a lot of sensitive information and cookies details. Be mindful file sharing these details to anyone.