Recommended resources
The freely available resources this lesson will direct you to.
Hello! Welcome to the final lesson of our "Advanced Network Analysis" module.
In our previous lesson, we explored the evolution of HTTP protocols, analyzing the performance benefits of HTTP/2 and HTTP/3 multiplexing right within the Network panel. This taught us how to diagnose performance issues related to the underlying transport protocol in a live session.
But what happens when a network issue is intermittent, or only happens for a specific user, or you need to share your findings with a colleague? Today, we'll address that by learning how to export, import, and analyze HAR files to share network logs for collaborative debugging. This skill allows you to capture a complete network session, save it, and share it, making debugging complex, environment-specific issues much more efficient.
What is a HAR File?
Before we generate one, let's understand what a HAR file is. HAR stands for HTTP Archive, and it's a standardized JSON-formatted file that logs all network interactions between a web browser and a website.
Think of it as a complete, high-fidelity recording of everything that happens in the Network tab for a given period. This includes every request and response, headers, cookies, content, and detailed timing information.
How to Work With HAR Files: A Step-by-Step Guide
To get a solid foundation, let's start with a clear definition of what a HAR file is, its structure, and why it's so important for debugging.
Please read the sections titled 'What is a HAR File and Why It Matters' and 'When and why you might need one'. Focus on understanding the JSON format and the specific troubleshooting scenarios where a HAR file is invaluable.
The article you just read highlights a key point: HAR files are your go-to tool when you need to see the full picture of an HTTP transaction, especially for issues like slow performance, incorrect rendering, or broken authentication flows that simpler debugging methods can't explain.
Here's a glimpse of what the raw JSON structure of a HAR file looks like. As a developer, you can appreciate how its structured nature makes it both human-readable and machine-parsable.

Generating and Sharing HAR Files in Chrome
Chrome DevTools makes it straightforward to capture and export a network log as a HAR file. The process is simple, but following a few best practices is crucial for capturing a useful log.
Best Practices for Capturing a Clean Log:
- Start with a clean slate: Either use an Incognito window or manually clear the browser cache and cookies. This prevents cached resources from being omitted from the log.
- Prepare DevTools:
- Open the Network tab.
- Check the Preserve log checkbox. This is vital for debugging issues that involve page reloads or redirects.
- Check the Disable cache checkbox. This ensures every resource is requested fresh from the server, giving you a complete picture of the page load.
- Reproduce the issue: With DevTools open and recording, perform the exact steps needed to trigger the bug or performance problem.
- Export the file: Once you've captured the problematic behavior, you can save the log.
You can export the HAR file using the down-arrow icon in the Network panel's toolbar.

Now, let's look at the official documentation for the precise steps.
The official Chrome documentation provides the exact steps for exporting and importing HAR files, including an important note on data privacy.
Please read the section 'Save all network requests to a HAR file'. Pay close attention to the difference between a 'sanitized' HAR and one 'with sensitive data'.
A Critical Note on Security
As the documentation points out, HAR files can contain extremely sensitive data, including cookies, authentication tokens, and POST data which might contain passwords or personal information.
- Sanitized HAR (Default): Chrome's default export option attempts to remove sensitive headers like
Cookie,Set-Cookie, andAuthorization. This is the safer option for sharing. - HAR with sensitive data: Sometimes, debugging an authentication issue requires seeing those exact headers. Only use this option when absolutely necessary and be extremely careful about who you share the file with. Always treat a non-sanitized HAR file as if it contains your login credentials.
When asking a user or customer for a HAR file, it's your responsibility to inform them of this risk.
Importing and Analyzing HAR Files
This is where the collaborative power of HAR files comes into play. A colleague or user can send you their captured HAR file, and you can import it directly into your own DevTools Network panel.
To import, you can either:
- Drag and drop the
.harfile onto the Network panel's request table. - Click the up-arrow icon (Import HAR).
Once imported, the Network panel will populate with the exact session data from the file. You can now use all the sorting, filtering, and analysis tools you're already familiar with, as if you had recorded the session yourself.
The analysis workflow is the same one we've been building throughout this course.
How to Work With HAR Files: A Step-by-Step Guide
This guide provides an excellent walkthrough of how to approach the analysis of a HAR file to find common problems.
Read the sections 'How to Analyze HAR Files: Step-by-Step' and 'Real-World Examples and Troubleshooting Tips'. This will show you how to apply your existing Network panel skills to a loaded HAR file to find bottlenecks and errors.
Common Analysis Steps:
- Filter for errors: Use the filter bar to find requests with problematic status codes (e.g.,
status-code:404for missing files, orstatus-code:5..for server errors). - Identify slow requests: Sort the waterfall by
Timeto find the slowest requests. Select a slow request and open the Timing tab to see where the bottleneck occurred (e.g., a longWaiting (TTFB)time points to a slow backend). - Trace dependencies: Use the
Initiatorcolumn or holdShiftand hover over requests in the waterfall to see what triggered a specific request. - Inspect payloads: For API calls (e.g.,
fetch/XHR), check thePayloadandResponsetabs to verify the data being sent and received is correct.
Test your understanding!
A junior developer sends you a HAR file for a bug they're seeing. In the file, several critical CSS files are returning a 403 Forbidden status code, but only when they are working from their office network. The same app loads correctly for you on your home network. What is the most likely cause, and what would be your advice to the developer?
Show answer
The 403 Forbidden status indicates a permissions issue where the server understands the request but refuses to authorize it. Since the issue is specific to their office network, the most likely cause is a piece of network infrastructure, like a corporate firewall or proxy server, blocking requests to the CDN or domain hosting the CSS files.
Advice: Tell the junior developer to contact their company's IT support team. They should provide the domain name of the blocked resources and explain that it's being blocked by the corporate network, which is preventing the application from loading correctly. The HAR file provides the concrete evidence needed for the IT team to investigate.
Conclusion
You've now reached the end of the "Advanced Network Analysis" module. Today, we've bridged the gap between live analysis and collaborative, asynchronous debugging.
Key Takeaways:
- A HAR (HTTP Archive) file is a JSON-based log of all network activity, allowing you to save and share a browser session.
- When generating a HAR file, always use best practices like
Preserve logandDisable cacheto ensure the capture is complete and accurate. - Be mindful of security. HAR files can contain sensitive data, so use the
sanitizedexport option whenever possible and handle all HAR files with care. - Importing a HAR file into DevTools allows you to use the full suite of Network panel analysis tools as if it were a live session, making it an invaluable tool for debugging issues you can't reproduce locally.
This skill completes your toolkit for network debugging. You can now analyze live traffic, simulate various network conditions, understand the underlying protocols, and now, package it all up to share and analyze later.
In our next lesson, we will begin the final module of the course: Memory Leak Detection and Analysis. We'll start by exploring two fundamental concepts: learning to differentiate between Shallow Size and Retained Size to accurately assess the memory impact of objects.