I have been experiencing script related problems and would like to go through all the script files by disabling/enabling, to find out which is causing the problem.

So I'd like to be able to find out which module loads which javascript file. Then I can go by enabling disabling the modules.

How can I do that?

  • 1
    If you look at the source of the page you can see the path for each script. This will identify where the script is.
    – Alex Gill
    Commented May 1, 2013 at 11:53
  • I think in firebug and web developer toolbar of firefox also you will find the name and location of javascript which is causing the error. Commented May 1, 2013 at 11:58
  • Yes, I can find out where all the files are located but that does not help me. I need to find out which module is calling them and this information is not available in the source code -nor in the developer tools, as it is done on the server side.
    – turzifer
    Commented May 1, 2013 at 12:13
  • 3
    @turzifer Am I missing something? Can't you search the Drupal codebase for the filenames you find in the source to see which modules are adding them? Drupal doesn't keep track of which module/theme adds a JS file to the page so other than hacking drupal_add_js() with a debug backtrace I don't see how else you'd do it
    – Clive
    Commented May 1, 2013 at 12:53
  • 1
    @AlexGill You should write that up as an answer.
    – mpdonadio
    Commented May 1, 2013 at 13:00

2 Answers 2


"If you look at the source of the page you can see the path for each script. This will identify where the script is."


Typically the script located at...


...would more often than not only be used by the module of the same name


...or possible an include file


Obviously bare in mind that Drupal uses the jQuery library so references to errors might fallback to these files just because its been implemented wrong by the developer in the module. Its more than likely never going to be something wrong with the libraries.

  • 2
    Note that you have to turn off JS aggregation to see things this way.
    – mpdonadio
    Commented May 1, 2013 at 15:08

You can get the list of all JS file called for a page to built by a function drupal_get_js(). Though I have never used this or checked but this is what documentation says..

  • I would love to find out the reason for negative vote here...
    – RajeevK
    Commented May 2, 2013 at 5:10
  • Because it doesn't actually answer the question. OP wants to know which module loads which JavaScript, and you are proposing a solution that just lists all currently loaded JavaScript.
    – Chapabu
    Commented May 5, 2013 at 21:50
  • I don't find any problem with the answer here. If I am facing any problem due to any JS file at any page, I can see what are the JS have been called during loading of the page by help of this function... I can find the location of all one by one & do what ever I want.. This is the best way to follow from my point of view with comparison to going to each module & finding JS files over there...
    – RajeevK
    Commented May 6, 2013 at 10:39
  • And if you please read the question - He said, he is facing some problem, which usually happens while visiting any page...& want to know the location of the JS files...which my given function can do.. But still you have got reputation & power to down vote...so be it... Thanks
    – RajeevK
    Commented May 6, 2013 at 10:42

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.