Skip navigation

Activating ActiveX Controls with JavaScript

 

For the past couple of years, Microsoft has been locked in legal battles with a company namedEolas Technologies. For more information on ActiveX, see " Activating ActiveX Controls with JavaScript ." Michael Doyle, formerly of the University of California, owns a patent that defines how ActiveX controls such as QuickTime, Flash, Media Player, and others are displayed in the browser. The patent was awarded in November of 1998 and has been a source of dispute for many years now. As of April 11th, Microsoft distributed a security update via Automatic Update that disallows interaction with ActiveX controls unless they are enabled. The current default interaction model for some ActiveX controls is to display the following dialog box, or for others a tooltip instructing the user to click the control:

The second interaction model, the one that simply displays a tooltip, is essentially an inactive ActiveX control. This inactive control will still perform actions that do not require user interaction, but will not allow user interaction until the control itself is activated. Functionality lost in inactive controls includes mouse events, such as onClick, or interactions from the keyboard. For example, a Windows Media movie would still play; however, the user would not be able to click pause without first activating the control.

 

Temporary Solution

Currently, Microsoft has released a compatibility update that resets Internet Explorer back to the previous mode of handling ActiveX controls. This was provided as a mechanism to allow large organizations time to test new solutions and deploy these solutions. You can find this temporary solution at http://support.microsoft.com/kb/917425. However, one thing to note is that this will only be a fix until the update cycle this month, at which point the new changes will be brought into effect and will then be permanent.

 

Permanent Solution

One thing not covered in the patent was the ability to load an ActiveX object from an external JavaScript file. When loading from an external JavaScript file, the Web browser will not display the dialog box or the control activation. While this solution is a little extra work for the developer, the end result will be exactly what the end user has come to expect. Keep in mind that you can t simply load the ActiveX object inline using JavaScript. You have to explicitly separate the logic into a separate .js file in order to get this to work.

One method to activate your ActiveX control is to use document.write to load the control dynamically. For instance, if I wanted to load a flash movie, the code may look something like this:

//JavaScript File "JSLoadExternal.js"

document.write('');

document.write('');

document.write('');

document.write('"timeline4.swf" width="800" height="800"> ');

document.write(''); 

The corresponding HTML code would look something like this:



 

 

 

   

Rather than have multiple JavaScript files to load multiple different ActiveX objects, you may find it better to actually have a generic call inside the JavaScript file that you can call and input parameters to dynamically create the ActiveX object. For instance, a method that looks something like this:

//JavaScript File "JSLoadExternal.js"

function RunActiveX(DivID, Movie, Width, Height )

{

    var divTag = document.getElementById(DivID);

 divTag.innerHTML = "
"; }

The corresponding HTML code might look something like this:



 

   

 

 

      
ReplaceMe

 

Conclusion

These are just a few examples of how you can provide workarounds for the problems caused by the Eolas lawsuit. Microsoft, Apple, and Adobe have provided resources on ways to solve the problems introduced by this lawsuit for their technologies. In closing, if you want to provide the same user-experience that your end users are accustomed to, then you are going to have to follow the above mentioned methods to achieve it.

 

Resources

 

Andrew Flick is Product Manager - NetAdvantage Windows Forms Technologies & TestAdvantage for Infragistics, Inc. Prior to joining Infragistics, Andrew played an avid role in presenting on emerging .NET technologies throughout the Midwest to a variety of User Groups as well as numerous Student Groups. As an active member of the INETA Academic Committee, Andrew has authored content on building successful User Groups, as well as numerous white papers on building an effective community. A Microsoft MVP, Andrew joined Infragistics in July of 2004 as a Technology Evangelist, where he was responsible for the creation of reference applications and authoring .NET technology articles for industry leading publications, as well as the world wide delivery of Infragistics Technology demonstrations. Andrew currently serves as Infragistics Product Manager for NetAdvantage Windows Forms Technologies & TestAdvantage. As product manager, he spearheads the product management and strategies of Infragistics Windows Forms Product Lines from establishing the direction through delivery. Working directly with the Director of Development, he sets the direction, plans, and manages product development. Contact Andrew at mailto:[email protected].

 

Anthony Lombardo is Product Manager of NetAdvantage - ASP.NET Technologies for Infragistics, Inc., and is responsible for spearheading product management and strategies for Infragistics ASP.NET product line, working directly with the Director of Engineering to set the direction, plan, and manage product development. Prior to joining Infragistics, Anthony served as a Network Administrator for North Brunswick Board of Education and worked for Rutgers University in their technical support division. Since beginning his career with Infragistics in 2000, Anthony has been involved with every aspect of the development cycle, including playing a key role in the creation of the Presentation Layer Framework for ASP.NET, assisting in the creation and implementation of Infragistics Visual Studio 2005 project plan, and determining the product feature set for NetAdvantage 2005 for Visual Studio 2005. Contact Anthony at mailto:[email protected].

 

 

 

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish