505

The Chrome network debugger gives me a great view of all the HTTP resources loaded for a page. But it clears the list whenever a new top-level HTML page is loaded. This makes it very difficult to debug pages that automatically reload for one reason or another (running script or 300 responses).

Can I tell Chrome not to clear the network debugger when a new top-level page is loaded? Or can I go back and look at the previous page's network resources?

Or can I somehow force Chrome to pause before loading a new page when I don't control the page I'm trying to debug that's doing the redirecting? It's part of an OpenID dance that's going awry, so the combination of SSL and credentials makes it extremely difficult to debug with command-line tools.

2
  • 8
    @Pacerier The one you linked doesn't appear to be posted by you, but the reasoning is likely that it doesn't have "Chrome" in the title. When people are looking for something related to Chrome their search usually includes the keyword Chrome. "Google Developer Tools" is incredibly ambiguous. Commented Aug 20, 2015 at 15:41

4 Answers 4

697

This has been changed since v32, thanks to @Daniel Alexiuc & @Thanatos for their comments.


Current (≥ v32)

At the top of the "Network" tab of DevTools, there's a checkbox to switch on the "Preserve log" functionality. If it is checked, the network log is preserved on page load.

Chrome v33 DevTools Network Tab: Preserve Log

The little red dot on the left now has the purpose to switch network logging on and off completely.


Older versions

In older versions of Chrome (v21 here), there's a little, clickable red dot in the footer of the "Network" tab.

Chrome v22 DevTools Network Tab: Preserve Log Upon Navigation

If you hover over it, it will tell you, that it will "Preserve Log Upon Navigation" when it is activated. It holds the promise.

7
  • 1
    In version 32 it's still there, but has moved to the top of the network panel. Commented Feb 25, 2014 at 6:11
  • 4
    Actually, it's now at the top, but called "Preserve log", and is a checkbox. Confusingly, there's still a red record icon, but that's just whether to log at all.
    – Thanatos
    Commented Mar 23, 2014 at 23:53
  • 1
    Thanks for commenting on the change, I just updated the answer accordingly.
    – bfncs
    Commented Mar 25, 2014 at 8:39
  • 2
    @boundaryfunctions I know, I've been using it for a few weeks, but yesterday I updated Chrome to version 43.0.2357.65 and it doesn't work the way it used to anymore. Now the request that produces the redirect is replaced by the next request, I have to be very quick to click on the first request to see the details before it disappears. Can you check this behavior with your latest version of Chrome? To be clear, all previous request are preserved in the log, but the one that produced the redirect disappears.
    – rubenlop88
    Commented May 28, 2015 at 14:01
  • 14
    @rubenlop88 Make sure you're not filtering on Documents, otherwise they won't persist there. You can check them specifically in the Other tab.
    – alex
    Commented Jun 9, 2015 at 1:21
242

I don't know of a way to force Chrome to not clear the Network debugger, but this might accomplish what you're looking for:

  1. Open the js console
  2. window.addEventListener("beforeunload", function() { debugger; }, false)

This will pause chrome before loading the new page by hitting a breakpoint.

4
  • 73
    This wasn't the right answer for the question, but it's actually what I'm looking for. Thanks.
    – isaaclw
    Commented Jul 29, 2013 at 20:05
  • 3
    This is so slick. I got here looking for a "pause before redirect" solution and here it is. The accepted answer is easier to remember but this is rad. Commented Aug 20, 2015 at 15:33
  • 26
    This is extremely useful, because chrome does not shows the server response body, if the browser redirects right after getting the response. Commented Oct 8, 2015 at 12:41
  • This is useful, but I still do not see the <meta HTTP-EQUIV="REFRESH" content="0;url=/somewhere/over/the/rainbow"> tag in the response. I need to investigate how the redirect is done, and I still do not have access to the reponse before the redirect...
    – G. Y.
    Commented Sep 25, 2023 at 12:56
61

Another great solution to debug the Network calls before redirecting to other pages is to select the beforeunload event break point

This way you assure to break the flow right before it redirecting it to another page, this way all network calls, network data and console logs are still there.

This solution is best when you want to check what is the response of the calls

Chrome beforeunload event break point

P.S: You can also use XHR break points if you want to stop right before a specific call or any call (see image example) XHR break point

4
  • 4
    This is great. With the load event, we can stop at the beginning and set break point easily. Thanks! Commented Mar 4, 2019 at 17:47
  • This doesn't work for me just by ticking the checkbox. The javascript snippet window.addEventListener("beforeunload", function() { debugger; }, false) is necessary. Commented Jan 20, 2021 at 13:08
  • 1
    No, it's not. I'm using it daily.
    – Ofir Hadad
    Commented Jan 21, 2021 at 14:57
  • "This solution is best when you want to check what is the response of the calls" Preserving not just the request data while being redirected from one site to another, but also the response data is exactly what I need. Four years have past since your post and a seemingly obvious feature such as having the network trace capture and keep the raw response data still isn't supported?
    – Kevin
    Commented Jul 8, 2022 at 22:36
26

Just update of @bfncs answer

I think around Chrome 43 the behavior was changed a little. You still need to enable Preserve log to see, but now redirect shown under Other tab, when loaded document is shown under Doc.

This always confuse me, because I have a lot of networks requests and filter it by type XHR, Doc, JS etc. But in case of redirect the Doc tab is empty, so I have to guess.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.