views:

50

answers:

2

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?

Thanks, Hristo

+1  A: 

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

Georg Fritzsche
:) I don't care if your opinion is biased :) FireBreath seems like a cool project and I'll look into it more in depth. Thanks for your response... I have some reading to do now.
Hristo
@Georg Fritzsche... I made a plugin project for Mac and I'm trying to test the plugin, but Firefox is telling me that I need to install missing plugins. It tells me that no suitable plugins are found, so how do I get my plugin to work with firefox?
Hristo
@Hristo: Did you install the `MyProject.plugin`, e.g. put it into `~/Library/Internet\ Plug-Ins/`? If you don't mind google groups, the fb-dev mailing list gets you pretty fast responses from more people than me :)
Georg Fritzsche
I was looking at the wiki on the google group, must have overlooked the part putting it into the ~/Library/... part. Thanks!
Hristo
+2  A: 

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; 
    }
  }
}
Eugene
This seems like it got rid of the error, but another popped up for where later in the code there is `xmlhttp.Open("GET", PageURL, false);`
Hristo