title: How do I open a local text file and display the contents in my browser?
body: <p>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:</p>
  
  <pre><code>&lt;a href='#' onclick='readTextFile("file:///F:/folder1/abc.txt")' title='Summary'&gt;&lt;h3&gt;Summary&lt;/h3&gt;&lt;/a&gt;
  
  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);
  }
  </code></pre>
  
  <p>This is the error I am getting:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>My webpage is running locally on a local server.</p>
  
  <p>Is it even possible to open and read local files?Seems like something browsers should probably not allow.</p>