Click to Activate and Use this control
By: Samson Jr. in JSP Tutorials on 2006-12-11
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 -->
<html>
<body leftmargin=0 topmargin=0 scroll=no>
<script src="docwrite.js"></script>
</body>
</html>
// 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 -->
<html>
<body>
<div id="embedControlLocation">
<script src="embedControlOuterHTML.js"></script>
</div>
</body>
</html>
// outerhtml.js
embedControlLocation.outerHTML = '<embed src="examplecontrol">';
The next example uses document.createElement to load an ActiveX control using the OBJECT element.
<!-- HTML File -->
<html>
<body>
<div id="DivID">
<script src="createElementExplicit.js"></script>
</div>
</body>
</html>
// createElementExplicit.js
var myObject = document.createElement('object');
DivID.appendChild(myObject);
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 -->
<html>
<head>
<script src="external_script.js" language="JScript"></script>
</head>
<body>
<div id="EXAMPLE_DIV_ID">
This text will be replaced by the control
</div>
<script language="JScript">
CreateControl( "EXAMPLE_DIV_ID",
"clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6",
"EXAMPLE_OBJECT_ID", "600", "400", "example.wmv",
"-1")
</script>
</body>
</html>
// 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 -->
<html>
<body>
<div id="embedControlLocation">
<script id="elementid" src="embedControl.js"></script>
</div>
</body>
</html>
// embedControl.js
document.writeln('<script>');
document.write('document.writeln(\'');
document.write( '<object classid =
"clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6"
width="100" height="100" />');
document.write('\');');
document.writeln('</script>');
For more details visit http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp
Add Comment
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
- Data Science
- Android
- React Native
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
Comments