As a direct result of the as the 'Eolas Patent', in the fall of 2005, Microsoft was forced to update Internet Explorer to ensure that it did not infringe upon the letter of the patent. The patent did not allow for the direct invocation of embedded objects within a web site by the browsing software.
By utilizing Javascript, it is said, the browsing software does not directly invoke the embedded object — it is directly invoking Javascript, of which is invoking the embedded object. Circular logic to say the least, but it allows us to stay legal and not compromise our audiences needs.
The advantage is your plug-ins will be able to run unaffected on the client side on the worlds most popular web browser. The disadvantage is that if the user has shut off javascript it will not play. From our experience, if a user has specifically shut off javascript, they did so willingly and are missing out on good deal of web content as it stands.
Our method for this will be to take the standard object as written in HTML and convert it to a Dynamic HTML format using javascript's document.write function.
The HTML code we would be embedding would normally look somewhat like this:
<OBJECT id="mediaPlayer" width="496" height="381"
classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
<param name="fileName" value="mms://wms.indiana.edu/ip/nmstream/wm/Nathanpcmac496x336.wmv">
<param name="animationatStart" value="true">
<param name="transparentatStart" value="true">
<param name="autoStart" value="true">
<param name="showControls" value="true">
<param name="loop" value="false">
</OBJECT>
To start out, we need to create a file for the javascript. We'll save this as "windowsstreaming.js" in the same directory as the html file we are going to be adding this code to.
Next, we go through the source code and convert all single quotes with a double quote. HTML and javascript consider either to be standard. What we are doing is to ensure that when we have added this to the .js file we will not have to use trick characters to force javascript to understand what we are doing.
Next, we encapsulate every line with the document.write(); function. This requires that we also surround the text with a quote of some type. We have chosen double for the HTML so a single quote is used for the Javascript. The file will now look something like this:
document.write(' <OBJECT id="mediaPlayer" width="496" height="381" ');
document.write(' classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" ');
document.write(' codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"');
document.write(' standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">');
/* ... CODE CUT ... */
document.write(' </OBJECT>');
Also note every line ends with a semi-colon.
To finish this out, we'd then encapsulate this into a function:
function InsertMovie()
{
document.write('\n <OBJECT id="mediaPlayer" width="496" height="381" ');
/* ... CODE CUT ... */
}
In the HTML file, we need to add two things: the script and the function call.
<html> <head> <script src="./windowssreaming.js" type="text/javascript"></script> </head> <body> <script type="text/javascript"> InsertMovie(); </script> </body> </html>
This is all that is needed to embed the video utilizing Javascript to enable external plug-in media automatically. There are more elegant methods and many of the major web authoring tools have started to update their methods to incorporate this type of embedding. The hope is that in a year from now, this page will be useless to all but those manually encoding their HTML from text.