Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am using the activexobject in my project it works fine in IE.

I know this is the microsoft control.
I want to run the project in Mozila and Chrome but it showing the error as Activexobject is not defined.

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");


Thanks in advance
Posted
Updated 7-Jul-17 2:42am
v3

Eventhough totally agree with JSOP's answer there is one thing you can try to also get it to run on FireFox. There is a plugin that enables FireFox to host ActiveX control elements. See here: http://code.google.com/p/ff-activex-host/[^]. You'll have to experiment a bit I guess, but maybe this plugin will help you to get it to work with FireFox. For google chrome you might be interested in this link: http://www.chromeplus.org/[^].

For cross browser compatiblity reasons I strongly discourage the use of ActiveX on a web site though.

Best Regards,

—MRB
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 30-Jun-11 17:56pm    
You must be right, my 5, but it does not save the concept of the ActiveX on client side (browser). For compatibility, it's the best to never use them.
--SA
Espen Harlinn 17-Jul-11 9:44am    
Very nice to know, solves a common problem - my 5
thatraja 17-Jul-11 11:03am    
New to me, 5!
Actually, the google code project reference by Manfred, support google Chrome as well.

It also provides some security measures such as site locking, CLSID/PROGID locking, and incompatibility with IE-style HTML/JS code for creating ActiveX controls.

Disclaimer: I developed and am maintaining that project.
 
Share this answer
 
v2
Comments
Espen Harlinn 17-Jul-11 9:45am    
I'm fairly certain I'll find a use for that plugin, my 5
Your problem can be solved using jQuery:
http://knol.google.com/k/xml-parsing-using-jquery#[^]

Or you can do something similar to:
C#
function parseXML(str) {
    if (str == null) return null;
    if ($.trim(str) == "") return createDocument();

    var dom = str;
    if ($.browser.msie) {
        dom = new ActiveXObject("Microsoft.XMLDOM");
        dom.async = "false";
        dom.loadXML(str);
    }
    else if (typeof (DOMParser) != "undefined") {
        var parser = new DOMParser();
        try {

            dom = parser.parseFromString(str, "text/xml");
        } catch (e) { };

    }

First try the MS way, then try what usually works with other browsers ...

Best regards
Espen Harlinn
 
Share this answer
 
Comments
thatraja 17-Jul-11 11:05am    
Today I found many jQuery answers, 5!
Espen Harlinn 17-Jul-11 11:34am    
Thank you, thatraja - when I have to work with something as "painful" as javascript, I can appreciate a library such as jQuery
thatraja 17-Jul-11 11:35am    
I put jQuery(to learn quickly) in my ToDos. Within 1 or 2 months I'll be a jQuery coder. Let's see.
Espen Harlinn 17-Jul-11 11:40am    
That's probably a good idea as jQuery is included with VS2010 and ASP.NET MVC.
No browsers support ActiveX except IE. Why? Because nobody in their right mind would allow an activeX component to be loaded from a web site unless the network is tightly controlled, and the activeX component is from a locally controlled source.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 30-Jun-11 17:55pm    
Absolutely. My 5.
--SA
Espen Harlinn 17-Jul-11 9:52am    
Using ActiveX based components in IE is quite common for corporate sites - like AspenTech IP.21 Process Browser - http://www.aspentech.com/products/aspen-web21.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900