title: How to debug javascript as a popup window loads?
body: <p>What is the  most effective way to debug JavaScript code that runs in a popup window? Specifically I need to trace what is happening as the page loads.</p>
  
  <p>This is for SCORM 1.2 courses running in an LMS, which depends on other JavaScript objects in a parent window, so debugging the popup by itself won't work.</p>
  
  <p>I could use a technique for other contexts though most of my time is debugging these courses.</p>
  
  <p>I could use something like an option in the in-browser debugger that pauses on the first line of JavaScript that executes for a popup page, as if I put a breakpoint there. (I can't, or at least don't know how, to set breakpoints until well after the page has started)</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>The <code>debugger;</code> statement works, but only for code I control.  I sometimes need to trace JavaScript that runs as some popup window opens, and can't add breakpoints because the code has already run.</p>