The SWFObject API is awesome, use it instead:

  drupal_add_js('http://ajax.googleapis.com/ajax/libs/swfobject/2.1/swfobject.js');

The above will not work if you have preprocessing on. Thank you.

....... On a side note, external JavaScript is in Drupal 7. For caching that, see #219346: Cache External Javascript.

Comments

Robert Castelo’s picture

Status: Active » Fixed

I haven't used SWFObject API, but based on it's README.txt these are the advantages of SWFObject Filter:

  1. Uses SWFObject directly from Google Code instead of downloading it and installing on your server
  2. No need to add anything to your theme
  3. The person entering content triggers SWFObject script inclusion on the page, without needing the PHP filter enabled

I'll be happy to work with SWFObject API developers to merge the two projects if that seems like a good idea.

RobLoach’s picture

Status: Fixed » Active

What I mean to say is that you could have the filter use SWFObject API to add things to the page. Something like this maybe?

<swf src="http://example.com/object.swf" width="600" height="400">

It would read that values, and then call theme('swfobject_api') with the appropriate output.

Either way, this has been added to the similar module review group here.

This is not a fixed issue because if you turn on JavaScript preprocessing, the call to drupal_add_js() will not work. You'll either have to switch to SWFObject API, or use something like this:

drupal_set_html_head('<script type="text/javascript" src="http://example.com/example.js" />');

Thanks.