I have a page callback where I want to add a colorbox library by this code:

drupal_add_js('sites/all/libraries/colorbox/jquery.colorbox-min.js', 'file');

The file exists, path is right. But in html is this file not included. Why it does not work?

  • Looks right. Do you have checked the permission on jquery.colorbox-min.js ? Do you have checked you can access to this file in your browser : "mydomain.tld/sites/all/libraries/colorbox/jquery.colorbox-min.js" ? Do you have checked you really go through the page callback function ? Apr 22, 2016 at 14:29
  • Yes to all your points.
    – Incredible
    Apr 22, 2016 at 14:35
  • Your cache is cleared? Javascript aggregation is disabled? More questions... :-) Apr 24, 2016 at 16:54

1 Answer 1


That seems apply to your issue :

This problem occurs because the path to library is often incorrectly set as


The solution should be to correct the path. You need to place the whole Colorbox plugin directory after unpacking it in sites/all/libraries This means the path should look like



  • The file already is in sites/all/libraries/colorbox directory.
    – Incredible
    Apr 24, 2016 at 9:24
  • This is the point. The file don't have to be in "sites/all/libraries/colorbox" but in "sites/all/libraries/colorbox/colorbox". There are two colorbox in this last path. Apr 25, 2016 at 14:24
  • It does not help. I moved colorbox into colorbox/colorbox directory but no change.
    – Incredible
    May 2, 2016 at 8:52

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.