Including remote .js files to scripts[] array doesn't work

markj - July 15, 2009 - 18:48
Project:Zen
Version:6.x-1.0
Component:PHP Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

In my Zen subtheme .info file, adding

scripts[] = test.js

works; however, adding

scripts[] = http://mysite.com/scripts/header.js

doesn't -- the entry for the remote script is not showing up when I view source. Is there a way to include a remote .js file, or do I need to copy it to my local theme directory? We have a number of websites and want to keep this .js in one place, if possible.

I have cleared cached data to see if that made a difference.

#1

Kyth - October 15, 2009 - 16:55

Same problem here, and clearing cached data didn't help.

#2

JohnAlbin - October 24, 2009 - 12:56
Category:bug report» support request
Status:active» fixed

:-(

Unfortunately, Drupal doesn't allow us to add external javascripts in this way. I think that's been fixed in Drupal 7.

The work-around is to follow the comment on http://api.drupal.org/api/function/drupal_add_js/6 and use drupal_set_html_head().

#3

System Message - November 7, 2009 - 13:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.