Embed Tag Converter

Script for Converting QuickTime Object-Embed Tags to JavaScript Calls

In early 2006, Microsoft made available an updated version of Internet Explorer 6 for Windows. This version of Internet Explorer handles QuickTime and other ActiveX controls in a new way: instead of automatically rendering and displaying any QuickTime content present, the browser will prompt the user to confirm each QuickTime item on a page.

Not all websites are affected by these changes. Your website may be affected if it offers QuickTime content that is presented in an HTML web page using <object>, <embed>, or <applet> tags.

This page contains information about, and a download link for, an AppleScript droplet which automates the process of updating HTML pages containing QuickTime content. The script uses BBEdit to automatically open, scan, and edit all HTML files dragged onto its icon, replacing &lt;object&gt; tags containing &lt;embed&gt; tags with JavaScript calls to load the QuickTime content referenced in the replaced tags.

(NOTE: For additional details, please see the instructions provided on Apple’s Developer Connection site. Microsoft’s Internet Explorer update page also contains more information about this change.)

HTML Before Running Script

As a result of this change, you will need to replace any CSS object tags containing EMBED tags for QuickTime media with JavaScript function calls to dynamically load and display the media. In the following example, the CSS object tag (in red) contains an EMBED tag (in blue) used to display a QuickTime movie. Note that this script only modifies those object tags that contain embed tags.

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
	&lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;
	&lt;title&gt;Embedded QuickTime Content Example&lt;/title&gt;
	&lt;meta name="generator" content="BBEdit 8.2" /&gt;

<font color="#FF0000">&lt;object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="256"
	&lt;param name="src" value="http://movies.yourcompany.com/movies/coolmovie.mov"&gt;
	&lt;param name="controller" value="false"&gt;
	&lt;param name="autoplay" value="false"&gt;
	&lt;param name="bgcolor" value="000000"&gt;
	&lt;param name="target" value="myself"&gt;
	&lt;param name="href" value="http://movies.yourcompany.com/movies/coolmovie-refr.mov"&gt;
	&lt;param name="pluginspage" value="http://www.apple.com/quicktime/download/indext.html"&gt;</font>
	<font color="#0000FF">&lt;embed width="320" height="256" controller="false" target="myself"
		bgcolor="000000" border="0"


HTML After Running Script

The AppleScript droplet extracts the parameters and values from the EMBED tag and replaces the object tag with a JavaScript call (in red) to a JavaScript function contained in a script that is automatically loaded when the page is displayed (script code in blue within the HEAD section at the top). In addition, NO-SCRIPT code (in green after the BODY tag) is inserted by the AppleScript droplet, and is activated by the browser if the user has JavaScript turned off when loading the page.


<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
<html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en” lang=“en”>
<meta http-equiv=“content-type” content=“text/html; charset=utf-8” />
<title>Embedded QuickTime Content Example</title>
<meta name=“generator” content=“BBEdit 9” />
<script src=“URL TO THE JAVASCRIPT FILE” language=“JavaScript”

alt=“Please turn on JavaScript. The media content on this page requires
JavaScript to display.” width=“700” height=“70” border=“0”>

<script language=“JavaScript” type=“text/javascript”>



Configuring the Script

STEP 1: Download the AppleScript droplet archive. The unpacked ZIP archive will create a folder named Object Tag to JavaScript Call Script containing two items:

STEP 2: Download the Apple JavaScript file that is loaded by the JavaScript script in the HEAD section. After you download the ZIP archive, double-click it to unpack a text file named: AC_QuickTime.js

STEP 3: Copy Files to Your Server. Copy both the javascript-inactive.gif and AC_QuickTime.js to your server. Write down their URLs for later use.

STEP 4: Set the Script’s Preferences. Double-click the script droplet to access its opening dialog.

Click the Set URLs button to summon the dialogs for entering the URLs of the JavaScript file and NO-SCRIPT image you placed on your web server.

The first preference dialog is for entering the URL of the JavaScript file you copied to your server.

Enter the URL of the JavaScript file and then click the OK button to summon the next preference dialog.

The second preference dialog is for entering the URL of the image file you copied to your server.

Enter the URL of the image file and then click the OK button to return to the main dialog.

The main dialog now displays the value of the preferences you set. The script is ready to be used. Click OK to close the dialog.

Test the Script

You are now ready to test the script on some files duplicated from your server. Drag the duplicate files, or the folders containing the files, onto the script droplet. Read and approve the forthcoming confirmation dialog, and the script will open and edit each HTML file with object tags that contain embed tags.

Once the script has completed processing the text files, open them in your browser to make sure the Quicktime contents loads properly.

Run the Script

Since the changes which the script makes to files cannot be undone, we strongly recommend that you work on a copy of your site. The script will process either any individual files which you drop onto its icon, or all the files within any nested folders whose containing folder you drop onto its icon.