title: Set the text file to read in JavaScript?
body: <p>I am testing out a file reader for one of my html projects. I want the JavaScript program to read a particular file immediately, instead of the file being selected by the user (in this case, me). I have the p tag and the id of the tag as 'file'. When I run the program in my browser (Safari), I get the error message</p>
  
  <pre><code>TypeError: Argument 1 ('blob') to FileReader.readAsText must be an instance of Blob
  </code></pre>
  
  <p>I have been looking all over the internet to find a solution, but I just can't find anything. I was thinking of doing my program with python and then inserting it into my webpage with trinket.io's iframe tag. But then I sort of gave up on that idea. Here is the code:</p>
  
  <pre><code>var reader = new FileReader();
  var fileToRead = "quotes.txt";
  
  // attach event, that will be fired, when read is end
  reader.addEventListener("loadend", function() {
    document.getElementById('file').innerText = reader.result;
  });
  
  reader.readAsText(fileToRead);
  </code></pre>
  
  <p>I would like the output of this program to show the contents of the text file, yet when I run it in my browser it gives me a blank screen. I hope there is a solution out there.</p>