T
Tom de Neef
1) The code below works fine with IE and FF when the requested file is
local.
2) But when I try to load the file from a http://www ... address IE does it
and FF fails.
So, from 1) I conclude that the code is correct. The XMLHttpRequest object
is created, the "GET" works, etc.
Since IE works in 2) I know that the file is accessible.
I have given up to understand why FF fails in 2).
Can you give it a look and advise me pls.
Tom
function LoadFile(how,url)
{
var req = false;
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest && !(window.ActiveXObject))
{ try { req = new window.XMLHttpRequest() }
catch(e) { req = false }
}
else // branch for IE/Windows ActiveX version
{ if (window.ActiveXObject)
{ try { req = new ActiveXObject("Msxml2.XMLHTTP") }
catch(e)
{ try { req = new ActiveXObject("Microsoft.XMLHTTP") }
catch(e) { req = false }
}
}
}
if(req)
{ req.open(how, url, false)
req.send(null)
return req.responseText
}
return ""
}
LoadFile("GET",someFile)
local.
2) But when I try to load the file from a http://www ... address IE does it
and FF fails.
So, from 1) I conclude that the code is correct. The XMLHttpRequest object
is created, the "GET" works, etc.
Since IE works in 2) I know that the file is accessible.
I have given up to understand why FF fails in 2).
Can you give it a look and advise me pls.
Tom
function LoadFile(how,url)
{
var req = false;
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest && !(window.ActiveXObject))
{ try { req = new window.XMLHttpRequest() }
catch(e) { req = false }
}
else // branch for IE/Windows ActiveX version
{ if (window.ActiveXObject)
{ try { req = new ActiveXObject("Msxml2.XMLHTTP") }
catch(e)
{ try { req = new ActiveXObject("Microsoft.XMLHTTP") }
catch(e) { req = false }
}
}
}
if(req)
{ req.open(how, url, false)
req.send(null)
return req.responseText
}
return ""
}
LoadFile("GET",someFile)