Reading Local Xml From Javascript
I want to read a locally stored xml, and I want to read/write through javascript. my code is as follows function saveBaseValue() { var xmlhttp; var XMLname='file:///C:/Users/se
Solution 1:
you can achieve your goal by using the below code.
<!DOCTYPE html><html><head><script>functionsaveBaseValue()
{
var xmlhttp;
varXMLname="file:///C:/Users/setting.xml"if (window.XMLHttpRequest)
{
xmlhttp=newwindow.XMLHttpRequest();
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4)
{
alert(xmlhttp.responseXML);
}
};
xmlhttp.open("GET",XMLname,false);
xmlhttp.send();
}
}
saveBaseValue();
</script></head><body><h1>Test</h1></body></html>
By default your browser will not allow you to access this local file as this a security concern, however if you want to access it anyhow then close all chrome instance, go to command prompt, change the directory to where your chrome.exe is present and run below command.
.\chrome.exe--allow-file-access-from-files--disable-web-security
Post a Comment for "Reading Local Xml From Javascript"