2
votes

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 not 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?

2
Eugene has a good point - i somehow assumed that you are using some custom ActiveXObject. Do you or is it limited to that XmlHttp object? - Georg Fritzsche

2 Answers

5
votes

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; 
    }
  }
}
3
votes

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 ;)