I want to constantly observe the content of a changing XML file by setting an interval, which calls the reader.readAsText()
function. I can access the data, till the XML file gets updated the first time.
From then the reader throws a DOMException named "NotReadableError", when trying to read the file. Then I have to reopen the file via the open file dialog, which I don't want to.
Any suggestions? Is this even possible?
Simplified code looks like this:
window.onload = function() {
setInterval(checkFile, 200);
}
function checkFile() {
var input = document.getElementById("file");
var file = input.files[0];
var reader = new FileReader();
reader.onload = function(event) {
//stuff
};
reader.readAsText(file);
}
}
best regards.