admin管理员组

文章数量:1317909

I am currently using javascript to enable changes to css on hover for certain items in my html page. In Firefox I never get an ActiveX message but in IE8 I get a message stating "To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your puter. Click here for options..." I'm assuming its because of the javascript I have:

sfHover = function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

The hover effects still work in IE8 without me clicking on the warning and allowing ActiveX.

My questions are: 1) Is there a way for me to change the javascript I have in place for the hover effects so the ActiveX warning doesn't pop up? 2) Is there code to disable the ActiveX warning since the website works fine in IE even with the warning?

Thank you

I am currently using javascript to enable changes to css on hover for certain items in my html page. In Firefox I never get an ActiveX message but in IE8 I get a message stating "To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your puter. Click here for options..." I'm assuming its because of the javascript I have:

sfHover = function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

The hover effects still work in IE8 without me clicking on the warning and allowing ActiveX.

My questions are: 1) Is there a way for me to change the javascript I have in place for the hover effects so the ActiveX warning doesn't pop up? 2) Is there code to disable the ActiveX warning since the website works fine in IE even with the warning?

Thank you

Share Improve this question asked Oct 24, 2010 at 3:27 EverTheLearnerEverTheLearner 7,21016 gold badges59 silver badges73 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

That's the default security restriction when you open it by local disk file system instead of by webserver. In other words, it won't occur when you change the security restrictions in the browser configuration or serve it by a (local) webserver like http://localhost/test.html

In Firefox I never get an ActiveX message

ActiveX is MSIE proprietary, you indeed won't ever see this on browsers other than MSIE.

You can try this if it work :

Add this to your ASPX code.

    <!doctype html>
<!-- saved from url=(0023)http://www.contoso./ -->

It happens only when you work with local files, if it still bothers you, check this out: http://msdn.microsoft./en-us/library/ms537628(VS.85).aspx

本文标签: javascriptHow do you avoid the dropdown ActiveX warning in IE7 and IE8Stack Overflow