Javascript ActiveX control instructions newActiveXObject () _ jquery

Source: Internet
Author: User
ActiveX controls are widely used in the Internet. They can increase browsing pleasure by providing videos and animated content. However, these programs may have problems or provide you with unwanted content. What is ActiveX Control?

ActiveX controls are widely used in the Internet. They can increase browsing pleasure by providing videos and animated content. However, these programs may have problems or provide you with unwanted content. In some cases, these programs can be used to collect information from your computer, damage data on your computer, install software on your computer without your consent, or allow others remotely control your computer. With these risks in mind, you should install these programs with full trust in the publisher.

What do you do when Windows blocks the installation of ActiveX controls?

You may not install the ActiveX control. Installing ActiveX controls blocked by Windows is an extremely risky task. If the security settings of Internet Explorer are at the default level and the ActiveX control does not have a valid digital signature, Windows will prevent the installation of this ActiveX control.

A valid digital signature identifies the publisher (the company, website, or individual distributing the document) and confirms the fact that the document has not been tampered with since its signature. If the file does not have a valid digital signature, you cannot determine whether the file actually comes from the source it declares, or whether it has not been tampered with (for example, a virus may be inserted into the control ). Unless you trust the publisher and know that the file is safe after it is opened, you should not open the file.

Note: The following statement generates an Active object based on the browser version.

XmlHttp = newActiveXObject (aVersions [I]);

This line of JS Code generates an XMLHttpRequest object ..

The name of ActiveX plug-in is enclosed in brackets.

The complete statement should be written as follows:

The Code is as follows:


Var xmlHttp;
Function createXMLHttpRequest (){
If (window. ActiveXObject)
{
Var aVersions = ["MSXML2.XMLHttp. 5.0", "MSXML2.XMLHttp. 4.0", "MSXML2.XMLHttp. 3.0", "MSXML2.XMLHttp", "Microsoft. XMLHttp"];
For (int I = 0; I {
Try
{
XmlHttp = new ActiveXObject (aVersions [I]);
Return;
}
Catch (oError)
{
}
}
}
Else if (window. XMLHttpRequest)
{
XmlHttp = new XMLHttpRequest ();
Return;
}
Throw new Error ("XMLHttp object cocould not becreated .");
}


Supplement:The reason is that various browsers have different support for JavaScript. Therefore, XmlHttpRequest objects are generated in different ways. For example, IE. ActiveX is supported.

["MSXML2.XMLHttp. 5.0", "MSXML2.XMLHttp. 4.0", "MSXML2.XMLHttp. 3.0", "MSXML2.XMLHttp", "Microsoft. XMLHttp"]; these are ActiveX versions.

Some browsers, like FireFox, support XmlHttpRequest. the browser has built-in objects. You can use "xmlHttp = new XMLHttpRequest ();".

If (window. XMLHttpRequest) is used to determine whether the browser has a built-in XmlHttpRequest object.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.