Active Content

In case you haven't heard, Microsoft is changing the way Internet Explorer handles plugins (in response to the Eolas Patent Ruling). Basically, updated Internet Explorer browsers will block content embedded in HTML pages with APPLET, EMBED, or OBJECT elements, generating an annoying dialog asking the user to 'click OK to run active content' and load the relevant ActiveX control. Even more annoyingly, if a page uses these elements to load multiple controls, each interactive control must be individually activated.

For most controls, the control is visible but is inactive until the user 'activates' it and users are prompted with a relatively benign 'tool tip'. However, Shockwave (and Quicktime) are handled differently and an ugly dialog box appears before the control is run in Internet Explorer. (The reason for this is that these controls use Windows API functions, such as GetKeyState and GetCursorPos to determine the state of the keyboard and mouse and then respond to the function results - see Activating ActiveX Controls).

The simple work around is to use Javascript to write out the code to embed Shockwave. Here is an example Javascript function:

function ShowDCR (src, w, h, sw1) {

	var html = '';

	html += '<object type="application/x-director" data="'+src+'"
           width="'+w+'" height="'+h+'">';

	html += '<param name="src" value="'+src+'" />';

	html += '<param name="sw1" value="'+sw1+'" />';

	html += '<param name="swRemote" value="swSaveEnabled=\'false\' 

    swRestart=\'false\' swPausePlay=\'false\' swFastForward=\'false\' 

    swContextMenu=\'false\' "/>';

	html += '<param name="swStretchStyle" value="none" />';

	html += "</object>";



To display a shockwave movie 'test.dcr' with sw1 parameter 'foo', you would include this in your html:

<script type="text/javascript">

	ShowDCR('test.dcr', 500,200,'foo');


Demo and Download

Here is a test movie, and here is a more extensive javascript file (that will also write the embed tag for Netscape/Safari users). Check back soon for a more sophisticated script to handle a greater range of parameters.

More information

First published 21/07/2006