How do you avoid the drop-down ActiveX warning in

2020-06-23 05:41发布

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 computer. 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

3条回答
家丑人穷心不美
2楼-- · 2020-06-23 06:07

You can try this if it work :

Add this to your ASPX code.

    <!doctype html>
<!-- saved from url=(0023)http://www.contoso.com/ -->
查看更多
劫难
3楼-- · 2020-06-23 06:12

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.

查看更多
成全新的幸福
4楼-- · 2020-06-23 06:15

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

查看更多
登录 后发表回答