Ok, I have a webpage that will run locally, every hour it needs to read a csv "output.csv" and put its contents into a table. The output.csv is generated from a local program automatically. The goal being an internal status board.
The only thing I can't seem to figure out is, without a server or xmlrequst how do I load a plaintext into javascript? (the rest of it should be easy)
This is the code that I've tried:
var reader = new FileReader();
reader.onload = function(event) {
var contents = event.target.result;
console.log("File contents: " + contents);
};
reader.onerror = function(event) {
console.error("File could not be read! Code " + event.target.error.code);
};
reader.readAsText("output.csv");
EDIT:
I've read that using this option "--allow-file-access-from-files" will override the settings and allow me to read local files from chrome. I'm sure there is a way.
FileReaderobject directly (var reader = new FileReader()).FileReaderobjects are obtained indirectly: as a result of a user selecting or from a drag and drop operationFileReader?var reader = new FileReader()work ok