Click here to Skip to main content
11,412,400 members (64,856 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET

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 29-Jun-11 2:29am
Edited 17-Jul-11 3:55am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
SAKryukov at 30-Jun-11 17:55pm
Absolutely. My 5.
Espen Harlinn at 17-Jul-11 9:52am
Using ActiveX based components in IE is quite common for corporate sites - like AspenTech IP.21 Process Browser -
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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:[^]. 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:[^].

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

Best Regards,

SAKryukov at 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.
Espen Harlinn at 17-Jul-11 9:44am
Very nice to know, solves a common problem - my 5
thatraja at 17-Jul-11 11:03am
New to me, 5!
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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.
Espen Harlinn at 17-Jul-11 9:45am
I'm fairly certain I'll find a use for that plugin, my 5
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

Your problem can be solved using jQuery:[^]

Or you can do something similar to:
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";
    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
thatraja at 17-Jul-11 11:05am
Today I found many jQuery answers, 5!
Espen Harlinn at 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 at 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 at 17-Jul-11 11:40am
That's probably a good idea as jQuery is included with VS2010 and ASP.NET MVC.

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

  Print Answers RSS
0 OriginalGriff 332
1 Sascha Lefévre 200
2 Maciej Los 135
3 ProgramFOX 130
4 Sergey Alexandrovich Kryukov 115
0 Sergey Alexandrovich Kryukov 9,025
1 OriginalGriff 7,247
2 Maciej Los 3,525
3 Abhinav S 3,248
4 Peter Leow 3,059

Advertise | Privacy | Mobile
Web02 | 2.8.150414.5 | Last Updated 17 Jul 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100