ActiveXObject object
The ActiveXObject object is used to create instances of OLE Automation objects in Internet Explorer on Windows operating systems.
Several applications (Microsoft Office Word, Microsoft Office Excel, Windows Media Player, ...) provide OLE Automation objects to allow communication with them.
You can use the methods and properties supported by Automation objects in JavaScript.
Unfortunately, the ActiveXObject object is only supported by Internet Explorer. For a cross-browser solution, use the object element instead.
Unfortunately, the ActiveXObject object is only supported by Internet Explorer. For a cross-browser solution, use the object element instead.
Syntax:
Creating an ActiveX object:
var activeX = new ActiveXObject (appName.type [, servername]);
appName | Required. String that specifies the name of the application. |
type | Required. String that specifies the class or type of the object. |
servername | Optional. String that specifies the name of the server where the object should be created. |
Members:
The ActiveXObject object inherits from the ActiveXObject.prototype and Function.prototype objects.
The following lists only contain the members of the ActiveXObject and ActiveXObject.prototype objects.
An instance of the ActiveXObject can have several properties and methods depending on the type of the embedded application.
An instance of the ActiveXObject can have several properties and methods depending on the type of the embedded application.
Properties:
Property | Support | Description | |||||
---|---|---|---|---|---|---|---|
prototype | Returns a reference to the ActiveXObject.prototype object. The ActiveXObject.prototype object allows adding properties and methods to the ActiveXObject object that can be used with instances of the ActiveXObject object like any predefined property or method. The prototype property is static, it cannot be accessed from an instance of the ActiveXObject object, only ActiveXObject.prototype is allowed. |
Examples:
Example 1:
This example shows how to open a Microsoft Excel application with the ActiveXObject method.
Note that the default security settings of the Internet zone do not allow to initialize the Microsoft Excel ActiveX control for scripting in Internet Explorer, but it can be changed
(Tools / Internet Options / Security tab / Internet zone / Custom Level button / ActiveX controls and plug-ins section / Initialize and script ActiveX controls not marked as safe for scripting).
Example 2:
This example launches a Microsoft Word application and creates a new document with some text content.
Note that the default security settings of the Internet zone do not allow to initialize the Microsoft Word ActiveX control for scripting in Internet Explorer, but it can be changed
(Tools / Internet Options / Security tab / Internet zone / Custom Level button / ActiveX controls and plug-ins section / Initialize and script ActiveX controls not marked as safe for scripting).
|
External links:
User Contributed Comments