Forum Moderators: open

Message Too Old, No Replies

Firefox and xmlhttp

can it be done?

         

Jonesy Jones

6:33 pm on Jun 10, 2005 (gmt 0)

10+ Year Member



Here's my code.
function f(sFile,sDescription)
{
var xmlhttp;
try
{
if(window.ActiveXObject)
{
xmlhttp = new ActiveXObject("MSXML2.XMLHTTP")
alert('activex supported');
}
if(window.XmlHttpRequest)
{
xmlhttp = new XMLHttpRequest()
alert('mozilla or similar');
}

if(xmlhttp)
{
//do some stuff
}
else
{
alert('no xmlhttp');
}
}
catch(e)
{
alert(e.message);
}
}

Here are my questions
1) Can you post code here and make it pretty (indents etc.)?
2) In Firefox why do I always get 'no xmlhttp', is it not supported or is my test wrong?

TIA,
Jonesy

Jonesy Jones

7:03 pm on Jun 10, 2005 (gmt 0)

10+ Year Member




Answered my own question. Found this on www.spreadfirefox.com

if(typeof XMLHttpRequest!= 'undefined')
{
//do it.
}