Question

I can easily set breakpoints in embedded JS functions, but I don't see any way of accessing external JS scripts via Firebug unless I happen to enter them during a debug session. Is there a way to do this without having to 'explore' my way into the script?

@Jason: This is a good point, but in my case I do not have easy access to the script. I am specifically talking about the client scripts which are invoked by the ASP.Net Validators that I would like to debug. I can access them during a debug session through entering the function calls, but I could not find a way to access them directly.

Was it helpful?

Solution

To view and access external JavaScript files (*.js) from within Firebug:

  1. Click on the 'Script' tab.
  2. Click on the 'all' drop down in the upper left hand corner above the script code content window.
  3. Select 'Show Static Scripts'.
  4. Click on the dropdown button just to the right of what now says 'static' (By default, it should show the name of your current web page). You should now see a list of files associated with the current web page including any external JS files.
  5. Select the JavaScript file you are interested in and it's code will display in the content window. From there, you should be able to set breakpoints as normal.

OTHER TIPS

Place debugger; in your external script file on the line you want to break on.

Putting the "debugger;" line also does the trick for the Chrome debugger.

Clicking on the line number in the left hand margin should create a break point for you (a red circle should appear).

All loaded scripts should be available from the firebug menu - click where it says the name of the current file should show a drop down with all files listed.

After you place a break point in them, you can also call them by name in the firebug console, and see the output of (or step through) any intermediate functions. This can help when the main entry point calls many other helper functions, and you are really just concerned with how these helpers are working.

That being said, I don't knwo anything about ASP.Net validators, so its possible this doesn't apply.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top