开发者

How do you avoid the drop-down ActiveX warning in IE7 and IE8?

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 th开发者_开发百科at 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


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.com/ -->


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜