I try to build an offline, client-only-based app. Say I have two files, data.txt and read.html, both in the same directory.
Now all I want to do is to read (in read.html) the content of data.txt and, say, show it in a DIV (without any user interaction - so there is no <input type="file">
or anything).
I have read many articles on this, all saying that it is not possible due to security issues to open local files. But I am not sure whether this is true for an offline app. For example, I can "almost" achieve want I want by the following code:
var w = window.open("data.txt");
var content = w.document.body.textContent;
mydiv.innerHTML = editForPresentation(content);
w.close();
The only problem is that this works only for .txt files but not for e.g. .xlsx files because the browser (I use Edge) does not open the latter as plaintext.
There must be a simple method to do this that I overlook, right?