Reads the contents of the specified input file.
How to use javascript in html to read text file and display it. It consists of the following nine names. There are four inbuilt methods in the FileReader API to read local files. In this example we will just create a text area where the text will appear from the text file that has been used as an input in the indexhtml.
The result attribute contains an ArrayBuffer representing the files data. WhiletextAtEndOfSteam text textReadLine. The JavaScript code will be able to extract the text from any text file and display it in scriptjs.
Next is where is the plain text file. The following is the web page that will retrieve and display the names on load. Function readFilefileName var fileRead new ActiveXObjectScriptingFileSystemObject.
To get the text to display with new lines etc use a or a ie. Reads the contents of the specified input file.