3

How do you debug a script that was loaded with the jquery getScript(), it does not show up in the google chrome scripts list ?

Captain0
  • 2,583
  • 2
  • 28
  • 44

1 Answers1

0

what are you looking for? getScript uses GET and should appear in the network tab. It is then executed safely from within jQuery (afaik, there was an alternative to eval). also getScript also allows for a callback, which you can use to determine if the script is loaded, like say add a console.log?

check if that part of your code gets executed at all. your code might not have reached that part of your script.


here's a demo of getScript loading another script (kernelJS). I can see it from the resources. enter image description here

Joseph
  • 117,725
  • 30
  • 181
  • 234
  • The script is loaded, it works. But when trying to add a breakpoint to she reminders.js file which i am loading, i can not find the file anywhere – Captain0 Apr 20 '12 at 10:12
  • I added a demo in jsfiddle as well as a screenshot. and i can see the script loaded. – Joseph Apr 20 '12 at 10:21
  • my code is like yours except for the fact that i have a callback function when the script is done loading. But sill i do not see it in the scripts list on chrome – Captain0 Apr 20 '12 at 11:44
  • 3
    The script appears in the list only when it is loaded from a different domain. http://stackoverflow.com/questions/690781/debugging-scripts-added-via-jquery-getscript-function – Konstantin Schubert Oct 27 '12 at 23:38