/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Firefox Error: Error: ActiveXObject is not defined – Works fine in IE

Hi Guys,

Hopefully somebody may be able to help me with this one. I getting the error

Error: ActiveXObject is not defined
Line: 154

The code executes without a problem in IE so i am not to sure what is happening. Here is a copy of the code:

function GetxmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new xmlHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(“Msxml2.XMLHTTP”);
}
catch (e)
{
xmlHttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
}
return xmlHttp;
}

If anybody could please give me any advise on why this is not working in Firefox I would be very thankful.

Thanks in advance,

almac007

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@FangMar 10.2009 — Case is important. XMLHttpRequest
Copy linkTweet thisAlerts:
@almac007authorMar 10.2009 — Fang... thanks so much for your advice.

I cant believe overlooked that ?

Changed the code to XMLHttpRequest() and it worked perfectly!

Thanks again!!! ?
Copy linkTweet thisAlerts:
@githikaApr 18.2018 — @Fang#987014 Thank you so much! This solved my issue.
Copy linkTweet thisAlerts:
@githikaApr 18.2018 — @almac007#986985 I was just using ActiveXObject and not XmlHttpRequest. I was not sure why it was not working in Firefox. It works now. Thank you!
×

Success!

Help @almac007 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 3.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,

tipper: Anonymous,
tipped: article
amount: 10 SATS,
)...