Reputation: 3229
I'm trying to use the chrome developer tools to debug an issue I'm having with Twitter oauth.
When the oauth window appears, I open the developer tools to monitor the requests - but as soon as the oauth window closes the developer tools window is also closed. I'd like to be able to keep the developer tools window open so that I can inspect the requests made.
Is this possible?
Upvotes: 113
Views: 77400
Reputation: 9659
Try using remote debugging. In this case Developer Tools will be opened in a separate browser tab that won't be closed automatically.
To do this you will need to open two instances of Chrome:
chrome://inspect
and find the first instance.Upvotes: 5
Reputation: 1739
Not a perfect solution, but you can add breakpoints on the events Window.close
and unload
by turning on the checkboxes at:
Developer tools -> "Sources" tab -> Event Listener Breakpoints -> Window -> close
And
Event Listener Breakpoints -> Load -> unload
Try to mark both and see which one works best for you
Upvotes: 131
Reputation: 4539
Another option is to manually add a breakpoint yourself. Open up your closes-too-quickly window, open up JS console, and:
window.addEventListener('unload', function() { debugger; })
But it all comes down to exactly what the window is doing, and when exactly you want to stop things, so experimenting with Event Listener Breakpoints in the Sources tab, as in @jfhfhf839's answer, is a good idea too.
In my case (debugging Google OAuth flow), neither Window -> Close
nor Load -> Unload
did the trick, but Script > Script First Statement
was useful, though I had to resume execution a few times before I got to where I wanted.
Upvotes: 31