Using Browser Debugging Tools
Choose a browser tool based on the evidence you need. Checking values and execution order is more useful than making several guesses at once.
| Tool | Use it to inspect |
|---|---|
| Console | Errors and labelled diagnostic values. |
| Elements | The current DOM, classes, attributes, and styles. |
| Sources / Debugger | Execution and variable values while JavaScript is paused. |
| Network | Request status, response content, and missing resources. |
| Application / Storage | Saved keys and values for the current origin. |
Names vary between browsers. Inspect the running page: its DOM may differ from the original HTML after JavaScript updates it.
Pause and inspect
In Chrome, open Sources, locate the script, and select a line number to set a breakpoint. Perform the action that reaches it. Inspect the relevant variables and call stack while execution is paused. Resume when you have the evidence you need. See the Chrome breakpoint reference.
Stepping over advances without entering a called function; stepping into follows its execution; stepping out returns to the caller. A breakpoint helps establish whether a handler ran and where values changed.
Checklist
- [ ] I selected a tool that matches the problem.
- [ ] I checked whether the relevant handler runs.
- [ ] I inspected values before and after the suspected operation.
- [ ] I checked requests or storage when those features are involved.
- [ ] I removed temporary breakpoints and restored any offline testing setting.