When I open Developer Tools in Google Chrome, I see all kinds of features like Profiles, Timelines, and Audits. but basic functionality like being able to set breakpoint both in js files and within html javascript code is missing!. I tried to use javascript Console which itself is buggy ( like when once it encounter JS error, cannot get out of it unless refresh the whole page useless when ajax is involved). Can some one help?
Use the sources tab, you can set breakpoints in javascript there. In the dropdown underneath it (with the up and down arrow in it), you can select the file you want to debug. You can get out of an error by pressing resume on the right-hand side of the same tab. |
|||||||||
|
Are you talking about code within
Either way, the
N.B. Chrome won't pause at You can also set property breakpoints in JS files and
|
|||||||||||||||||
|
Refresh the page containing the script whilst the developer tools are open on the scripts tab. This will add a (program) entry in the file list which shows the html of the page including the script. From here you can add breakpoints. |
|||
|
If you cannot see the "Scripts" tab, make sure you are launching Chrome with the right arguments. I had this problem when I launched Chrome for debugging server-side JavaScript with the argument |
||||
|
My situation and what I did to fix it:
Now entering the Javascript Debugger in Chrome, I click the Scripts Tab, and drop down the list as shown above. I can clearly see scripts/common.js however I could NOT see the current html page test.html in the drop down, therefore I could not debug the embedded javascript:
That was perplexing. However, when I removed the obsolete type="text/javascript" from the embedded script:
..and refreshed / reloaded the page, voila, it appeared in the drop down list, and all was well again. |
|||||||
|