Forum Moderators: open

Message Too Old, No Replies

AJAX and MAC

Some problem to create XMLHttpRequest object on MAC

         

papadym

1:33 am on Jan 8, 2007 (gmt 0)

10+ Year Member



Hi Guys,

I haven't problem with following function on Windows and got one on MAC with IE 5.2, Firefox 1.5.0.9 and Safari 2.0.4 which is
"Error creating the XMLHttpRequest object.".

Can someone helps me, please?

// creates an XMLHttpRequest instance
function createXmlHttpRequestObject()
{
// will store the reference to the XMLHttpRequest object
var xmlHttp;
// this should work for all browsers except IE6 and older
try
{
// try to create XMLHttpRequest object
xmlHttp = new XMLHttpRequest();
}
catch(e)
{
// assume IE6 or older
var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
"MSXML2.XMLHTTP.5.0",
"MSXML2.XMLHTTP.4.0",
"MSXML2.XMLHTTP.3.0",
"MSXML2.XMLHTTP",
"Microsoft.XMLHTTP");
// try every prog id until one works

for (var i=0; i<XmlHttpVersions.length &&!xmlHttp; i++)
{
try
{
// try to create XMLHttpRequest object
xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
}
catch (e) {}
}
}
// return the created object or display an error message
if (!xmlHttp)
alert("Error creating the XMLHttpRequest object.");
else
return xmlHttp;
}
// end of function

cmarshall

1:49 am on Jan 8, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I sent you a PM. Check it out.

papadym

2:22 am on Jan 8, 2007 (gmt 0)

10+ Year Member



Ok, thanks for that.

eelixduppy

2:26 am on Jan 8, 2007 (gmt 0)



Welcome to WebmasterWorld, papadym!

Enjoy your stay!

...didn't want to forget you ;)