How to debug inline javascript within module

Topics: Troubleshooting
Dec 3, 2014 at 9:17 AM
I'm quite new to Orchard and do have the following problem. I've created a new module in which I use a razor view with some inline Javascript. There's something going wrong in the script so I want to debug it. Setting breakpoints in the script through VS2012 seems not to help as then the breakpoint never gets hit. So I thought let me use the developer tools of Chrome. However within the sources view the specific module and it's resources is never displayed. Is this something specific to Orchard or am I doing something (unintentionally) wrong?
Anyway ... can anybody help me out on how I can debug this kind of scenario (preferable through Visual Studio) ?
Ronald Brink
Dec 3, 2014 at 7:24 PM
I have run into the same issue when debugging javascript in Orchard, and have found that I can only seem to get it to work consistently via the developer tools of the browser.
If you have inline javascript you need to find where in the actual html source the script is and add your breakpoint there (using Chrome developer tools). As opposed to finding a specific source file, .js or whatever. Are you doing @Using(Script.AtHead or AtFoot at all? If so, there are a whole bunch of script blocks at the top and bottom of the html source that your code will be in - or directly inline somewhere if it is directly inline.

Dec 4, 2014 at 10:05 AM
@jgreywolf. Hi Justin, Thanks for your reply However with Chrome developer tools I can indeed see the script which is AtFoot. Within the Elements view (which is the DOM of the HTML document) of Chrome it seems I'm not able/allowed to put a breakpoint. It looks to me that breakpoints can only be set from the Sources view, but then again I cannot reach my inline script. Can you once again help me out on this?
Dec 5, 2014 at 2:40 AM
Try IE's F12 Developer Tools - I always use that to debug JavaScript, and it works with inline script, too.
Dec 5, 2014 at 10:53 AM
@sfmskywalker, Thanks, apparently Developer tools within IE do allow for inline script debugging while Chrome does not.