Due to security restrictions, the page cannot load the contents of files without something like a Java applet with the appropriate permissions; and even then it is not too possible.
However, this does not mean that it is impossible; just upload the file to the server and repeat the output to the browser. Here's how text editing web applications work.
How you implement this is up to you.
In addition, as Maz noted, you can also use the built-in APIs to help you accomplish what you are trying to do. However, note that this solution is not necessarily cross-browser compatible.
source share