Internet Explorer has restricted this page from running scripts or ActiveX controls that can access your computer

Source: Internet
Author: User

In the production of Web pages, it is unavoidable to use script, that is, scripts, mainly VBScript and JavaScript. So often this is the case:

When the local double-click Open HTML file, if it is IE, you will see a prompt box (such as):

The cause of this problem: IE protection mechanism, the default security level is high, of course, can modify their own IE browser to solve.

Method: Open the ie--tool--internet option--Advanced tab--security--tick "allow active content to run in files on my Computer"

This behavior does not occur in the following situations:

1, using 360 browser, roaming browser, Sogou browser and other browser browsing.

2, use the server to browse the Web. Use Apache or IIS to build a personal Web server, put the Web page file in the corresponding directory, use http://localhost/... Address access.

That is to say that the cause of this phenomenon is two, one is not through the server parsing to browse, but using our commonly used double-click to open in the browser browsing, but the use of IE browser browsing, if swapped with 360 or Sogou browser will not appear this situation.

If we consider that Web compatibility testing is necessary to use multiple versions of IE to test, and that it is not as easy to double-click Browse, then you need to find a solution to solve this uncomfortable tips.

Because this phenomenon is very common, so many people in the know or ask for help on the post, so in Csdn a blogger published an original article, specifically to solve the problem. Because the original text has been deleted, but because everyone think his answer is very useful, have been reproduced, copied.

See:http://www.baidu.com/s?wd=?????????????????? IE????????????? Chat??????????????? Activex??? &TN=SOGOUIE_1_DG

After detailed browsing, we find that the topics vary, but the methods are the same. For example, this article http://blog.dormforce.net/est/archives/109

Methods in Circulation:

In the HTML file! DOCTYPE down that line plus
<!–saved from Url= (0022) http://blog.csdn.net/electronixtar/–>
It's all right.

I always oppose plagiarism, so to evaluate whether plagiarism is very cautious, said plagiarism is very simple, in this method has an address http://blog.csdn.net/electroniXtar/, obviously this address is the original person left to prevent "reference not to leave the source". And if you Baidu search this address, you will find a lot of results and "IE has restricted this page run can access the computer script or ActiveX control" the more than 10 keyword hooks. Obviously copied the results of the few people, even Baidu know a lot of people also use this answer, and the answer is adopted.

In fact, I said in the above, this problem is very small, because in the actual development, the site must use the server, because in the operation of the site, will not appear this hint, even IE will not, the problem of friends do not have to worry too much, this is only a small problem.

I would like to say that the original idea and the reprint of the blind, so that some people have been wrong guidance.

First, the originator may know that this problem does not occur on the server, but he does not tell us this, because if you know this, her file value can not be reflected, it seems selfish.

Second, the original use of their own blog address purpose is understandable, but do a site, which is placed in other people's links, but also in the user seems very important to screen the wrong link. When browsing offline, can't link to this blog, will not appear prompt? Of course, perhaps this address is just a pretence, it will not be connected to, to be detailed verification. However, personal testing for certain addresses can be used, some do not, then this method reflects its limitations.

Finally, and most importantly, according to the

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en"
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<!–saved from Url= (0022) http://blog.csdn.net/electronixtar/–>

The written code, the effect is: Do not show tips, but few people found that this page is not a script hint is blocked, but the script in the Web page is not executed. I do not quite know why, the previous months of testing found that the original script can not be executed, today found that this method can not be used, the hint is still. If the script is not executed, then this is a serious problem, such a method with the contrary, if not add this code, on the server, there is no problem, so that a plus script invalidation, for a larger site, is absolutely catastrophic error. Of course, the specifics of whether the script will be blocked on the server, not tested. But this is just to remove the hint and not solve the fundamental script is blocked by IE, like quench thirst, hidden errors, lost the opportunity to find errors.

In addition to reprint plagiarism blind, because many people did not realize that the script was blocked, there is no hint, so blindly reprint boast too many people, so much so that the wrong method flooding.

So here, originally this problem is not big, for some people's needs, to provide the following methods

that is, add <!--saved from Url= (0014) about:internet in the middle of and maybe I can add something to this line of code, or my blog address of what, but I think for the site code, is for everyone to use, not to advertise for themselves. HTML code Some too much modification will affect the user, I believe if a webmaster network inside JS Code are some of the original web site can not be replaced, it will not be used by anyone.

For the acceptance of the people test. Write out the test code for this method, and it is recommended to clear IE cache before each test. can use any of the following versions of IE9

Code (1)

<HTML>
<HEAD>
<TITLE> Testing </TITLE>
</HEAD>
<BODY>
<script language= "JavaScript" >
<!--
now = new Date (), hour = Now.gethours ()
if (Hour < 6) {document.write ("Good Morning!")}
else if (Hour < 9) {document.write ("Good Morning!")}
else if (hour <) {document.write ("Good Morning!")}
else if (hour <) {document.write ("Good noon!")}
else if (hour <) {document.write ("Good Afternoon!")}
else if (hour <) {document.write ("Good Evening!")}
else if (hour <) {document.write ("Good Evening!")}
else {document.write ("Good Night!")}
-
</script>
</BODY>
</HTML>

According to the method of circulation

Code (2)

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/ Xhtml1/dtd/xhtml1-transitional.dtd ";
<!–saved from Url= (0022) http://blog.csdn.net/electroniXtar/ –>
http://www.w3.org/1999/xhtml ";
<HEAD>
<TITLE> test </title>
<body>
<script language= "JavaScript";
<!--
now = new Date (), hour = Now.gethours ()
if (Hour < 6) {document.write ("Good Morning!")}
Else if (Hour < 9) {document.write ("Good Morning!")}
Else if (hour <) {document.write ("Good Morning!")}
Else if (hour <) {document.write ("Good noon!")}
Else if (hour <) {document.write ("Good Afternoon!")}
Else if (hour <) {document.write ("Good Evening!")}
Else if (hour <) {document.write ("Good Evening!")}
Else {document.write ("Good Night!")}
//-->
</script>
</body>

Add <!--saved from Url= (0014) about:internet--and after code

Code (3)

<HTML>
<!--saved from Url= (0014) about:internet--
<HEAD>
<TITLE> Testing </TITLE>
</HEAD>
<BODY>
<script language= "JavaScript" >
<!--
now = new Date (), hour = Now.gethours ()
if (Hour < 6) {document.write ("Good Morning!")}
else if (Hour < 9) {document.write ("Good Morning!")}
else if (hour <) {document.write ("Good Morning!")}
else if (hour <) {document.write ("Good noon!")}
else if (hour <) {document.write ("Good Afternoon!")}
else if (hour <) {document.write ("Good Evening!")}
else if (hour <) {document.write ("Good Evening!")}
else {document.write ("Good Night!")}
-
</script>
</BODY>
</HTML>

Test result: In IE8.0, double-click to open three code respectively. Both the code (1) and the Code (2) Prompt Tips, code (3) to execute the script command normally, with display results.

Code (3) that is the method provided in this article, the article is inappropriate, million hope everyone correct.

Internet Explorer has restricted this page from running scripts or ActiveX controls that can access your computer

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.