I have problems when using XMLHttpRequest. One occurs in Chrome; the other in firefox
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200)
elmnt.innerHTML = this.responseText;
}
if (this.status == 404) {
elmnt.innerHTML = "Page not found.";
}
}
}
xhttp.open("GET", file, true);
xhttp.send();
I'm working locally, i.e. all protocols are file://
In chrome, where I have added parameter --allow-file-access-from-files
, this.status is 0. Why?
In firefox, the status is 200, but there will be a XML parsing error when the included file has code like this:
<script>
alert(-1<1);
</script>
and an XML parsing syntax error occurred indicating 10th character.
Why? I guess firefox does not recognize '<' between script.
Are they bugs or some issues I don't know yet?