I intend to have a link in my webpage which will open a local text file and display its contents. This is what I have tried so far:
<a href='#' onclick='readTextFile("file:///F:/folder1/abc.txt")' title='Summary'><h3>Summary</h3></a>
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;
                alert(allText);
            }
        }
    }
    rawFile.send(null);
}
This is the error I am getting:
XMLHttpRequest cannot load file:///F:/folder1/abc.txt. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
My webpage is running locally on a local server.
Is it even possible to open and read local files?Seems like something browsers should probably not allow.
 
     
     
     
    