1

I am trying to load a javascript file in my .info file, but I can't tell if it is loading or not. What is the best way to find out if it is loaded and if it is the right path?

1 Answer 1

3

Some things you can try:

The easiest way, in my opinion, is to look at the source of your page. Right click the page of your website and click "View source" (or something similar). Try searching for the reference to the javascript file in there.

This could be somewhat more difficult if you're using Javascript aggregation, which means that your file might be concatenated with other Javascript files into one big file. In that case: open the files you see in your source and search for something that's in your Javascript file.

You could also try to display an alert by appending alert('It works!') to your file.

Edit:

As said by Clive in the comments: you might need to clear your cache for the Javascript file to be included. You can clear the cache at /admin/config/development/performance.

1
  • Beat me to it :) You also need to clear caches after altering the .info file, might be worth mentioning that
    – Clive
    Sep 14, 2012 at 17:48

Your Answer

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

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