Is there any way to see included JavaScript source code?

If I had JavaScript code that was injected into a page via:

<script src="someJavaScript.js"></script>

Open in new window


I noticed doing a View Source won't show it, but is there a way to see it in the browser debuggers? I clicked the Source tab and still can't see it.

I ask because I'd like to be able to debug it without having to copy/paste the entire JavaScript into a <script></script> enclosure just to be able to see/debug it.

Thanks.
elepilAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
depending on the browser, all objects referenced in a web page are often included in the cache.
a debugger will show the "code" where the issue is.  Though it is not clear what you are asking.


Are construction a .js file and should it have errors you are asking whether the debug/error will point to the file as the cause?
elepilAuthor Commented:
Arnold, thanks for responding.

What I want to do is be able to set breakpoints in JavaScript code. If the JavaScript code is not actually on the page itself, I can't see it. When something goes wrong, the only way I know of debugging is to copy/paste the JavaScript from the included file to the page itself, which is a pain. That's why I'm asking if there's a way to see included JavaScript code on the browser debuggers.
Rainer JeschorCommented:
Hi,
eg the built-in Developer Tools in Chrome support this.
Just open the page, activate the dev tools (Shift+Ctrl+i) go to the script tab. Then reload the page and open the referenced script file. Add your breakpoint and reload the page again.
HTH
Rainer
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

arnoldCommented:
Are you not using an IDE such as netbeans, etc. to develop your code?
elepilAuthor Commented:
To Rainier Jeschor.

I did what you said, and I can see where I can open up my .js file. So I opened up the file, then set a breakpoint at the line I wanted, and then closed down Chrome. I tried rerunning, but the debugger won't stop at the breakpoint I set, even though I can still see the blue breakpoint. What am I missing?
elepilAuthor Commented:
To Arnold.

Actually I am using Netbeans, but I am unsuccessful in making Netbeans stop at a breakpoint. I would pull up my .js file, click the line number column on the left to set a breakpoint, the entire line turns pink. Then I would do a Shift-Ctrl-F5 to debug, but Netbeans won't stop at that line. Is that the way you would do it?
arnoldCommented:
I gather you want to debug your code, but it seems you want the processing of your script to stop and the point you mark.

Not sure JS lends itself to that in the way you are running.

From rainer, perhaps the following combination chrome/netbeans and netbeans connector for chrom ref: https://netbeans.org/kb/73/webclient/html5-js-support.html will do what you are looking for.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
elepilAuthor Commented:
Thanks for the help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.