Javascript breakpoints not working in Chrome Devel

2019-07-12 13:17发布

问题:

Using firebug for Firefox, I can set a breakpoint in my JS code, refresh the page and the code will automatically pause at my breakpoint (my code runs on page load).

When I do the same in Chrome Developer Tools (Ctrl + Shift + J), it does not stop at the breakpoints. How do I get the code to stop at the breakpoints?

Also, my console.logs appear in firebug for Firefox, but not in the Chrome console. How do I get the Chrome console to display my console logs?

回答1:

Breakpoints work for me; Press Ctrl-shift-i, click the Scripts tab, select the script that you want, then click on the line number where you would like to set the breakpoint. Breakpoints may be disabled; make sure that the button on the right side of the Scripts tab (next to step over, step out, and step in buttons), shows a line through it.

If this isn't working for you, try restarting the browser, disabling extensions, creating a test HTML page,, etc.