Click to Activate and Use this control

By: Samson Jr. Emailed: 1651 times Printed: 2123 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

If you have an Active X control or any other object that you have embedded using the <object> then from mid of 2006 these controls will not be activated by default. Hence the users will see a 'Click to activate and use this control' message when they mouse over the object.

If some of your uses face this problem while others do not then the reason is because those who never face this problem have not updated their 'windows update' from IE. Those who have done 'Windows Update' recently will face this issue. 

The solution to this problem is you can ask your users to click on the object and then start using it. But if you want to programmatically activate this object when the JSP page or HTML page is loading then you can use the following methods to activate the active x programatically.

The following example uses document.write to load a control dynamically.

<!-- HTML File -->
  <body leftmargin=0 topmargin=0 scroll=no>
    <script src="docwrite.js"></script>
// docwrite.js
document.write('<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6">');
document.write('<param name="URL" value="example.wmv">');
document.write('<param name="autoStart" value="-1"></object>');

External script files can also modify an element's outerHTML property to achieve the same effect, as shown in the following example.

<!-- HTML File -->
    <div id="embedControlLocation">
      <script src="embedControlOuterHTML.js"></script>
// outerhtml.js
embedControlLocation.outerHTML = '<embed src="examplecontrol">';

The next example uses document.createElement to load an ActiveX control using the OBJECT element.

Important  When using createElement to add an Object or Embed element to a web page, use care to create the element, initialize its attributes, and add it to the page's DOM before creating the ActiveX control to be loaded by the new element. For more information, please see the createElement documentation.

<!-- HTML File -->
    <div id="DivID">
      <script src="createElementExplicit.js"></script>
// createElementExplicit.js
var myObject = document.createElement('object');
myObject.width = "200";
myObject.height = "100";
myObject.classid= "clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"; 
myObject.URL = "example.wmv";
myObject.uiMode = "none" ;

The next example uses innerHTML and a JScript function to load an ActiveX control while specifying parameter values.

<!-- HTML File -->
   <script src="external_script.js" language="JScript"></script>
   <div id="EXAMPLE_DIV_ID">
      This text will be replaced by the control
   <script language="JScript">
     CreateControl( "EXAMPLE_DIV_ID",
                    "EXAMPLE_OBJECT_ID", "600", "400", "example.wmv",
// external_script.js
function CreateControl(DivID, CLSID, ObjectID,
                       WIDTH, HEIGHT, URL, AUTOSTART)
  var d = document.getElementById(DivID);
  d.innerHTML = 
    '<object classid=' + CLSID + ' id=' + ObjectID + 
    ' width=' + WIDTH + ' height=' + HEIGHT +'>
    <param name="URL" value=' + URL + '>
    <param name="autoStart" value=' + AUTOSTART + '/>';

Because the next example uses the writeln function to insert the script into the original HTML document, the resulting control requires activation. To load a control without requiring activation, use one of the previous examples.

<!-- HTML File -->
    <div id="embedControlLocation">
      <script id="elementid" src="embedControl.js"></script> 
// embedControl.js
document.write( '<object classid = 
                width="100" height="100" />');

For more details visit

JSP Home | All JSP Tutorials | Latest JSP Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.

Bookmark and Share


Be the first one to add a comment

Your name (required):

Your email(required, will not be shown to the public):

Your sites URL (optional):

Your comments:

More Tutorials by Samson Jr.
Click to Activate and Use this control

More Tutorials in JSP
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: ` Permission denied <null>:80
JSP Alert Example
JSP CheckBox Example
Uploading an Image to a Database using JSP
Uploading a file to a server using JSP
A JSP page that gets properties from a bean
The page Directive in JSP
The taglib, tag, include, attribute and the variable Directive in JSP
Declarations in JSP
Scriptlets and Expressions in JSP
Tag Libraries in JSP
The Request Object in JSP
The Response Object in JSP
The Out Object in JSP
The Session Object in JSP

More Latest News
Most Viewed Articles (in JSP )
JSP Example to connect to MS SQL database and retrieve records
The Request Object in JSP
What are the different scopes in JSP?
JSP Alert Example
JSP CheckBox Example
Disabling Scriptlets in JSP using web.xml
Sending Email using JSP
Embedding java codes in jsp sciptlets
Combining Scriptlets with HTML
An Example Using Servlet Initialization and Page Modification Dates
Automatically Including Preludes and Codas in JSP
Calling JSP from a batch file
Deploying an Individual JSP on Tomcat
Using a DataSource from WebLogic in a JSP
Embedding a QuickTime movie in a JSP
Most Emailed Articles (in JSP)
Steps to get a Free SSL certificate for your Tomcat
What is JSP?
Retrieving a Portion of a String
Tag libraries
Tags using in jsp
Closing Windows
Getting HTTP Request Headers in a JSP
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: ` Permission denied <null>:80
Click to Activate and Use this control
Radio Object
Math Object
What is JSP?
Cookies using JSP or Java Bean
Built-in Object in Javascript
Frame Object