The information in this article applies to:
SUMMARY
The versions (1.0) of the VBScript engine that shipped with Internet
Explorer 3.0x did not support the CreateObject function, which is commonly
available in Visual Basic for Applications and Visual Basic.
MORE INFORMATION
VBScript 2.0 shipped with the Active Server Pages (ASP) component of
Internet Information Server (IIS) 3.0. ASP is used to produce server-side
script inside .asp files. ASP has always supported CreateObject. The rest
of this article refers to the use of CreateObject in client-side script,
which is evaluated by Internet Explorer 3.x, not ASP server-side script.
Keep in mind that there is no guarantee that all client machines viewing a
Web page will have a particular object installed. When using the <OBJECT>
tag for controls, a CODEBASE URL can be specified to provide for automatic
download of the control. With CreateObject, there is no such mechanism.
When using CreateObject, you may get the following scripting error:
This error message indicates that the object cannot be safely used within a
scripting environment. Either the object can be used to do some potentially
unsafe act such as write to the hard disk or set registry entries, or the
object just is not guaranteed to work correctly from within a protected
script language. Objects that are unsafe for scripting should not be
scripted in VBScript.
For information on marking objects safe for scripting, please see the following articles in the Microsoft Knowledge Base: Q164119 SAMPLE: Implementing IObjectSafety in an ActiveX ControlNote that the registry entries mentioned in these articles could be used on a client machine to mark any object as safe for scripting. This is recommended only in internal environments where the safety of objects in Web pages can be guaranteed and the use of an object that is not safe for scripting is necessary. These registry entries need to be applied by the client and cannot be forced on a client through script code. To conditionally test for the engine version currently installed on the client machine, and consequently whether the client supports CreateObject, the ScriptEngineMajorVersion function can be used in both VBScript and JScript. Here is an example snippet of VBScript code:
NOTE: In JScript 3.0, the new ActiveXObject function was introduced to
perform the same function as CreateObject in VBScript.
REFERENCESTo obtain the latest version of Microsoft scripting engines and see the latest Microsoft scripting news, visit the scripting Web site at: http://www.microsoft.com/scripting/ © Microsoft Corporation 1999, All Rights Reserved. Additional query words:
Keywords : InetSDKSafeControl vbsMisc AXSDKScripting |
Last Reviewed: November 17, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |