0

In IE I can set breakpoints and debug just fine.

enter image description here

In Chrome I'm able to view the script but I have no options to set a breakpoint in the code, nor is there a "scripts" tab to navigate to for debugging. I'm confused. (Restarted chrome multiple times). I tried also setting a "debugger;" flag in the code, but that didn't work in Chrome.

enter image description here

1
  • Which version of chrome are you using ? I am able to place breakpoints just fine .. Commented Aug 20, 2012 at 14:30

2 Answers 2

6

What I've found that works is the following (in Chrome 21.0.1180.79):

Open the dev tools (ctrl+shift+i), then click the "Sources" tab. Notice the small right pointing arrow in the grey bar, if you click this, it'll show all the .js files loaded.

Here's the trick. Refresh the page (F5) and now all the inline script is available in this section, so you can set breakpoints at your pleasure :)

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

1

Add a @sourceUrl comment to your script. Chrome will then list the script in the Scripts / Sources tab in the Chrome DevTools.

There is a pretty good writeup about @sourceUrl on HTML5Rocks: http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl

Even though the comment is called @source*Url*, you can put anything you want as a Url. It just needs to be a human-readable string which you'll use to find your script in the list of scripts.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.