Igor Zhukosvky

An issue of a Microsoft XP security update.

Problem:

After the Windows XP security update published at the April, 2006 the browsers IE6 and IE7 ask users to click twice on any active content on web pages (applets, Active-X objects, etc..) before allowing to interact with them.

How to resolve:

To rid users of double clicking on an applet the webmaster shouldn't define the applet tag in HTML directly but output it using JavaScript. Moreover, the JavaScript code that outputs the applet tag should be defined in a separate file and referenced from the HTML page.

Example:

Let's you have the following HTML code which describes an applet:
<applet code="Some.class" width="100" height="50" >
   <param name="param1" value="value1">
   <param name="param2" value="value2">
</applet>
In that case you have to:
  1. Create a JavaScript file (let's name it myscript.js):
    function writeApplet() {
       document.write('<applet code="Some.class" width="100" height="50" >');
       document.write('<param name="param1" value="value1">');
       document.write('<param name="param2" value="value2">');
       document.write('</applet>');    
    }
    
  2. Replace the applet's code in the HTML with the following:
    <!-- refer the JavaScript file (only once) -->
    <script language="javascript" src="myscript.js" > </script>
    ...
    <!-- output the applet -->
    <script language="javascript">
        writeApplet();
    </script>
    ...
    

 

A universal JavaScript code

If you have several applets on your website it's inconvenient to create a JavaScript function for each applet individually.
The file ie7fix.js (click to download) contains a universal JavaScript code that can be used for any applet.

The example below demonstrates how to use the code:

<script language="javascript" src="ie7fix.js" >
</script>
...
<script language="javascript">

// create an instance of the applet code
var myApplet = new Applet();

// assign necessary attributes for the Tag applet
myApplet.attr.code = 'Some.class';
myApplet.attr.width  = 100;
myApplet.attr.height =  50;

// assign necessary parameters
myApplet.param.param1 = 'value1';
myApplet.param.param2 = 'value2';

// output the applet code to the page
myApplet.write();

</script>

Other articles about the security update issue

http://msdn2.microsoft.com/en-us/library/ms537508.aspx
http://www.webreference.com/programming/ie/
http://blog.deconcept.com/2005/12/15/internet-explorer-eolas-changes-and-the-flash-plugin