开发者

ActiveX Object is not defined

Firebug is giving me the following error:

ActiveXObject is not defined
[Break on this error] var xmlhttp = new ActiveXObject("MSXML2.XmlHttp"); 

I've read that ActiveX is a Microsoft framework and its mostly used in IE. All of the internal web pages at the place I work were designed and built specifically for IE 6, but now they want me to research what it would take to move to Firefox and Safari and other major browsers... and ActiveX does n开发者_如何转开发ot work in Firefox.

So how do I get the ActiveX stuff to work in Firefox and Safari specifically on Mac (for starters)? I know there is a couple of plugins? that have made things easier... like FF ActiveX Host... but is there a programmatic solution to this?

If there is no solution, no plugin, for this problem, is it possible to rewrite the ActiveX pieces in Java?


I’m not a web guy but it seems like your web pages use AJAX.

So your problem is not using AcitveX in other browsers.

Try something like this:

var xmlhttp;
if (window.XMLHttpRequest) {
  xmlhttp = new XMLHttpRequest();
} else {
  try { 
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try { 
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
      xmlhttp = false; 
    }
  }
}


The Plugin-API nearly every relevant browser besides IE supports is the NPAPI, see e.g. this introduction.

I am not aware of any transparent programmatic soutions for adapting ActiveX, especially since its a Windows only technology.

An alternative might be the FireBreath project, which eases working with the NPAPI as well as giving you an abstraction layer over NPAPI and ActiveX - the idea being that you have to write most central parts only once.
Disclaimer: i am one of the owners of the project and thus probably biased ;)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜