35

I need to see the network traffic for a particular site of which I have no control. The problem is that the site at one point triggers a pop-up which automatically closes when a particular upload event is completed.

The HTTP requests I need to see, are only triggered at the moment of close which is when the upload completes. As soon as the window closes, so does the Dev Tools window.

Is there any way to force it to stay open? What about IE and Firefox?

Other tools that are not browser specific are not giving me the data I need. I know Chrome will - if only it hung around long enough for me to see it.

R. Oosterholt
  • 7,720
  • 2
  • 53
  • 77
user2029890
  • 2,493
  • 6
  • 34
  • 65

3 Answers3

50

You could set an window close event breakpoint. This way the debugger stops the window (popup) from closing.

devtools -> scripts (or sources) -> event listener breakpoints -> Window -> close

enter image description here

Link to Chromium rfc

R. Oosterholt
  • 7,720
  • 2
  • 53
  • 77
  • 12
    This doesn't appear to be working for me, not sure why. I checked the boxes but dev tools still closes when I lose the window.... – acolchagoff Mar 24 '16 at 20:56
  • 1
    At Chromium 64.0.3282.167, it looks where: devtools -> Sources -> event listener breakpoints -> Window -> close – Fumisky Wells Feb 23 '18 at 03:23
  • I tried on server without a luck. Google sign in popup disappeared and logs were lost. But when I tried on localhost it really stopped before closing. – Leos Literak Dec 20 '20 at 19:34
  • 1
    `Load --> beforeunload` event does the expected. – Omkar Shetkar Jul 16 '22 at 07:18
  • Any way to make these breakpoints active by default? I'm trying to debug a popup that only exists for a second in some circumstances, so there's no time to set it. – Kristaps Baumanis Jun 12 '23 at 09:22
9

Run the following code in the console when opening the popup:

window.addEventListener('beforeunload', function (e) {
  debugger;
});
Pietro Coelho
  • 1,894
  • 1
  • 26
  • 34
1

I use this chrome extension. It has a URL sniffer, which you can open in any window and it'll log all HTTP requests for you.

mjkaufer
  • 4,047
  • 5
  • 27
  • 55
  • That is an interesting tool. However, for some reason its not logging the particular request I need. Also, it doesn't return 'responses' like Dev Tools just the header request. – user2029890 Jan 12 '14 at 16:04
  • If you want to capture the response, simply take the request that was made and reenact it. The following extension is a great tool for making HTTP requests without a server. Good luck. https://chrome.google.com/webstore/detail/dev-http-client/aejoelaoggembcahagimdiliamlcdmfm?hl=en-US – mjkaufer Jan 12 '14 at 16:24