the News Letter Archives - from December 2003

          from December 2003 - Codehelp For Developers

Update (December 4, 2003):

As webdevelopers continue to wait on the promised Eolas fix-it tools from Macromedia, several enterprising coders have stepped into the breach. Unfortunately, their tools neither work correctly nor are they free. There's only two of them at the moment, but each features a limited free period before payment is needed. This allowed the Pacoima Ranch design team to experiment with them. Neither was any good, both had a tendency to lock and freeze and one of them actually damaged files.

For the moment, it is suggested to wait for Macromedia (and other major companies) to introduce suitable, supported, functioning tools to find and replace code OR to carefully handedit. The freelance tools are best avoided.

Original story (October 23, 2003):

One of the hardest parts of the Eolas crisis to truly wrap ones mind around is the sheer magnitude of the changes required to accommodate the newer Internet Explorers due in January (or so) 2004. Approximately 400 million pages (W3.ORG estimate, October 2003) need rewriting, and the recode is not a guarantee of patent compliance. While researching and hunting for how to make changes, any recode that appeared to violate the patent was rejected. This includes the IE-only THC file methods, and the JS-surround methods. Both of these leave an OBJECT, APPLET or EMBED tag in the HTML, which is most likely not kosher.

Another easy fix technically violates the patent, but is being strongly stressed. In the event that Microsoft or the W3.ORG wins their appeal or review, this method will actually become a new standard. W3.ORG has already suggested they may add it immediately to the current standards. This fix involves adding this attribute: noexternaldata="true"  to every OBJECT, APPLET, and EMBED tag as they currently are. Remember when using this method that it DOES violate the patent (as currently interpreted), but if Eolas loses the next round may become acceptable. Note that validators will kick out an error on the noexternaldata attribute. It's a quick and dirty fix that might become a new 'Net standard.

One method surfaced repeatedly in many forms, the external JS method. The OBJECT, APPLET or EMBED tag is completely removed from the page and placed inside an external nonHTML file. The JS file dynamically writes appropriate code via document.write tags in the JS directly to the browser, thereby totally sidestepping the OBJECT, APPLET, and EMBED tag inlined in HTML that is the basic Eolas patent.

Some tags may involve multiple classid attributes. Be sure to leave a single blank space and to include all of them in a single statement. This allows multiple plugins to be safely called. Some surfers will use MediaPlayer for .avi files, others will use QuickTime. Best to not lock people into a single plugin when possible.

Each of the samples in the rest of this article will show the special javascript for the head; the special javascript that replaces the OBJECT, APPLET, or EMBED tag; and the text of the external .js file. A sample page using this method will be referenced also so you can see the workaround in action. Workarounds have been tested in Internet Explorer 5.5, Internet Explorer 6, Netscape 4, Netscape 7, Opera 7, MSNTV (WebTV), Konqueror 1, and Konqueror 2. While getting used to doing these workarounds, it's suggested you test in at least Internet Explorer 5.5, Internet Explorer 6, Netscape 4, Netscape 7 and Opera 7.

.:VRML Fix:.

This one also requires a VRML plugin. Blaxxun 5.1 is very good and a 'Net standard. Here's a sample page with the fix. These are custom hacks.

This goes in the header:
<script src="indexopener_wrl.js" language="JavaScript" type="text/javascript"></script>


This goes in the body in place of the OBJECT or EMBED tag - the noscript part is to display a warning to people with scripting turned off:
<script language="JavaScript" type="text/javascript">indexopener_wrl();</script><noscript><img src="warning_plain.png" height="47%" width="97%" alt="turn on JavaScripting, JS, Scripting to fully use this page - plugins and ActiveX may also be required" title="turn on JavaScripting, JS, Scripting to fully use this page - plugins and ActiveX may also be required"></noscript>


And this is the external JS named "indexopener_wrl.js" - it goes in the same directory as the HTML page:
function indexopener_wrl()
{
document.write('<object classid="clsid: 4B6E3013-6E45-11D0-9309-0020AFE05CC8 clsid:86A88967-7A20-11d2-8EDA-00600818EDB1 clsid:06646724-BCf3-11D0-9518-00C04FC2DD79" name="CC3D" id="CC3D" width="95%" height="47%" noexternaldata="true">\n');
document.write('<param name="src" value="indexopener.wrl" />\n');
document.write('<param name="name" value="CC3D" />\n');
document.write('<param name="id" value="CC3D" />\n');
document.write('<param name="width" value="95%" />\n');
document.write('<param name="height" value="47%" />\n');
document.write('<embed src="indexopener.wrl" width="95%" height="47%" />\n');
document.write('</object>\n');
}


.:Flash Fix:.

This is the one everybody's freaked over. It's easier than it looks. This is an example of both the Flash fix and the Crescendo fix.

This goes in the header:
<script src="jukeboxsplash_3_swf.js" language="JavaScript" type="text/javascript"></script>


This replaces the tag in the body:
<script language="JavaScript"type="text/javascript" >jukeboxsplash_3_swf();</script><noscript><img src="warning_plain.png" height="400" width="700" alt="turn on JavaScripting, JS, Scripting to fully use this page - plugins and ActiveX may also be required" title="turn on JavaScripting, JS, Scripting to fully use this page - plugins and ActiveX may also be required"></noscript>


This is the text of the external JS called "jukeboxsplash_3_swf.js":
function jukeboxsplash_3_swf()
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="jukeboxsplash_3" width="700" height="400" border="0" loop="false" noexternaldata="true">\n');
document.write('<param name="src" value="jukeboxsplash_3.swf" />\n');
document.write('<param name="id" value="jukeboxsplash_3" />\n');
document.write('<param name="width" value="700" />\n');
document.write('<param name="height" value="400" />\n');
document.write('<param name="loop" value="false" />\n');
document.write('<param name="quality" value="high" />\n');
document.write('<param name="bgcolor" value="#ffffef" />\n');
document.write('<param name="type" value="application/x-shockwave-flash" />\n');
document.write('<param name="border" value="0" />\n');
document.write('<embed src="jukeboxsplash_3.swf" width="700" height="400" border="0" loop="false" />\n');
document.write('</object>\n');
}


.:Crescendo Fix:.

Crescendo is arguably the most common plugin there is. It plays .mid, .mpeg and .mp3 audio files. This is a totally custom fix hammered together by the Pacoima Ranch webdevelopers. Here's a sample of both the Crescendo fix and the Flash fix.

Place this part in the header section:
<script src="financial2_mid.js" language="JavaScript" type="text/javascript"></script>


This is the part to be placed in the body, it replaces the OBJECT, EMBED or BGSOUND tag:
<script language="JavaScript"type="text/javascript">financial2_mid();</script><noscript><img src="warning_plain.png" height="55" width="200" alt="turn on JavaScripting, JS, Scripting to fully use this page - plugins and ActiveX may also be required" title="turn on JavaScripting, JS, Scripting to fully use this page - plugins and ActiveX may also be required"></noscript>


This is the external JS, "financial2_mid.js" that dynamically creates the correct tags:
function financial2_mid()
{
document.write('<object classid="clsid: 0FC6BF2B-E16A-11CF-AB2E-0080AD08A326" name="Crescendo" id="Crescendo" console="false" detach="true" width="0" height="0" noexternaldata="true">\n');
document.write('<param name="src" value="Financial2.mid" />\n');
document.write('<param name="name" value="Crescendo" />\n');
document.write('<param name="id" value="Crescendo" />\n');
document.write('<param name="autostart" value="true" />\n');
document.write('<param name="width" value="0" />\n');
document.write('<param name="height" value="0" />\n');
document.write('<param name="detach" value="true" />\n');
document.write('<param name="console" value="false" />\n');
document.write('<embed src="Financial2.mid" autostart="true" detach="true" console="false" height="0" width="0" />\n');
document.write('</object>\n');
}

.:Java Fix:.

Whether the older APPLET or the newer OBJECT tag, many sites rely extensively on Java for games, navigation, sound, and interactivity. Be cautious about substituting OBJECT for APPLET, and for adding a nested APPLET inside OBJECT, it malfunctions in virtually all browsers. When testing the hacks, it was very common to find a solution that worked in all versions of Netscape, worked in all versions of Internet Explorer, yet failed in Opera. Other duds included failure in Internet Explorer 6 only. Obviously, any JS hack to dynamically create proper Java tags needs to work in ALL  the commonly used browsers. Try out an interactive coloring page. Requires JVM, JVM2 or java plugin. Works in all Java-enabled browsers.

This is the javascript for the header:
<script src="lgpaint_class.js" language="JavaScript" type="text/javascript"></script>


This one replaces the EMBED (or OBJECT) tag in the body:
<script language="JavaScript"type="text/javascript" >lgpaint_class();</script><noscript><img src="warning_plain.png" height="300" width="600" alt="turn on JavaScripting, JS, Scripting to fully use this page - plugins and ActiveX may also be required" title="turn on JavaScripting, JS, Scripting to fully use this page - plugins and ActiveX may also be required"></noscript>


This is the external file that goes in the same directory, "lgpaint_class.js":
function lgpaint_class()
{
document.write('<applet code="lgpaint.class" width="600" height="300" noexternaldata="true"></applet>\n');
}


The four samples above should give you a very good idea on how to code these fixes. Any plugin or ActiveX control with a public classid may be handled in this way. Be sure to test a fix before deploying it, minor tweaks may be needed. The above samples use individual fixes. It's also possible to do a special batch file JS that handles all instances of the same filetype. Once we get one running (probably for Crescendo), the how-to will be posted.

Here's a list of the places to go to download samples of the JS batchfiles (multiple references to the same external JS file for different  active content):

               MacroMedia (Flash & Shockwave)
               Apple (QuickTime)
               RealNetwork
               Microsoft (MediaPlayer)

With regards to naming conventions, use what makes sense to you. The design team opted to use a form of the name of the referenced file in the JS function and the final name of the JS file. This was just to make it easy to eyeball a directory and see the files and match them to the correct reference.

Strange Love
          

Michael Dana Murphy, Senior Editor
Brandon Kaufman, Senior Consultant

click me and go to the Archives click me and go to the Headlines click me to search The News Letter




© copyright 1999, 2003, Pacoima Ranch Offices. All rights reserved.

Best in any Generation 7 Browser (Netscape 8.x+, Mozilla 1.0x+, Internet Explorer 7.x+, Opera 8.x+ and WebTV Classic, Deluxe or MSNTV Spring 2005). For best viewing, we recommend Internet Explorer 7.x+, Firefox 1.x+, and Opera 8.x+. These fonts are used throughout the site (click the name, unzip and install if you are missing any - Windows only, please) Arial, Arial Black, Arial Rounded MT Bold, Times New Roman, and Verdana.

click me and return to the main entrance to Pacoima Ranch    click me and go to the entrance page of The News Letter