function readTextFile(file) {     
    var rawFile = new XMLHttpRequest();
    rawFile.open("GET", file, false);   
    rawFile.onreadystatechange = function () {   
        if(rawFile.readyState === 4) {   
            if(rawFile.status === 200 || rawFile.status == 0) {   
                var allText = rawFile.responseText;    
            }
        }
    }
    rawFile.send(null);
}
readTextFile('file:///C:/test.txt');
it errors with the message:
testini:41 Access to XMLHttpRequest at 'file:///C:/test.txt' from origin 'http://localhost:54862' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
 
     
     
    