Answer the question
In order to leave comments, you need to log in
How to open local xml file on android using javascript?
I have a local .html page with a button, when clicked, I want to open and parse a local .xml file in the android browser.
Tried to do it in two ways:
1)
load: function () {
$.ajax({
type: "GET",
async: false,
url: "structure.xml",
data: {
key: "value"
},
dataType: "xml",
success: function (xmlDoc) {
alert("success");
Parser.currentNode = xmlDoc.documentElement;
Parser.rootTagName = xmlDoc.documentElement.tagName;
Util.pathLoadedFiles = xmlDoc.documentElement.getAttribute("path");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
}
load: function () {
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "structure.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
if (xmlDoc.readyState == 4) {
Parser.currentNode = xmlDoc.documentElement;
Parser.rootTagName = xmlDoc.documentElement.tagName;
Util.pathLoadedFiles = xmlDoc.documentElement.getAttribute("path");
}
}
Answer the question
In order to leave comments, you need to log in
This is a blatant violation of security, I consider the ability to open files locally from a web application (even running locally) a huge hole. Apparently, IE still sins with this (probably they made a bunch of plugs in the mail client so as not to be full of holes).
On mind it by the way is configured in politicians (for IE).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question