Im trying to run some code which is designed to run locally.
So far it runs fine in Opera / Firefox but it doesnt work in Chrome.
The problem appears to be the XMLHttpRequest() – in Chrome it wont work off a local file but does if I upload my file to a server.
Heres the section:
var file = “file1.xml”;
try //Internet Explorer
{
xmlDoc=new ActiveXObject(“Microsoft.XMLDOM”);
xmlDoc.async=false;
xmlDoc.load(file);
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument(“”,””,null);
xmlDoc.async=false;
xmlDoc.load(file);
}
catch(e)
{
try //Google Chrome
{
var xmlhttp = new window.XMLHttpRequest();
xmlhttp.open(“GET”,file,false);
xmlhttp.send(null);
xmlDoc = xmlhttp.responseXML.documentElement;
}
catch(e)
{
error=e.message;
}
}
}
Is there anyway to get google Chrome to read the file locally ?