Drupal – Load External Javascript using drupal_add_js() @ 2

Here is another way to add the external .js file.

$external_js = 'http://www.example.com/a.js';
drupal_add_js('document.write(unescape("%3Cscript src=\''. $external_js . '\' type=\'text/javascript\'%3E%3C/script%3E"));', 'inline');

 

Done =)

Previous Post: Drupal – Load External Javascript using drupal_add_js() @ 1

Reference: Web Design by Tim Wooten – Load external js file in Drupal 6

One thought on “Drupal – Load External Javascript using drupal_add_js() @ 2”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.