I'm trying something fairly simple that used to work in OBS studio which uses the Chrome CEF.
All it would do (locally) was ask the browser to open a file in a child directory, read it and then allow it to be used however I saw fit. The code I used was this:
function loadDocSubscriber() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("subscriber").innerHTML =
this.responseText;
}
};
xhttp.open("GET", "textfiles/most_recent_subscriber.txt", true);
xhttp.send();
}
It worked fine until OBS updated the Chrome CEF to use CORS. While CORS should see the file opening as something from the same origin and allow it, I'm given to understand that it's instead reading it as 'file:///' and disallowing the javascript from displaying the contents of the opened .txt.
I believe that the objective is to satisfy the browser that the text file is from the same origin, to this end I've tried:
<meta http-equiv="Access-Control-Allow-Origin" content="*"/>
But alas that didn't work. The text files to be pulled from can't be altered as they're overwritten regularly, and any messy way of going about it would likely not work because CORS is a security feature and not meant to be circumvented.
How can I satisfy the browser's same origin requirements all while being done locally?