I have read that I can add js and css file via .info files. Can I add external css and js files there as well? Eg http://somewhere.com/in_a_galaxy

| improve this question | | | | |

External JS/CSS files can't be specified in the info file at all. You need to add them via hooks, typically I use THEMENAME_preprocess_page() for things that need to be included on all pages, or you can use drupal_add_js() in your .module file.

And you can refer to this page. Here you can see how many ways you can add script/css files.

| improve this answer | | | | |

To add external javascript.

drupal_add_js('http://example.com/example.js', 'external');

To add external css.

drupal_add_css('https://fonts.googleapis.com/css?family=Droid+Serif:regular', 'external');
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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