I want to create a simple game in HTML5/JS and I don't want the user to run any webserver or to have to connect to a website. (just an HTML page)
But it looks like FileReader can only be used on files type inputs.
Is it possible to have only two files : index.html and foo.txt side by side and to read foo.txt from index.html with something like :
// No input needed, I know waht I want to read
var my_file = new File("foo.txt");
var reader = new FileReader();
alert( reader.readAstext( my_file, "UTF-8" ) );
Any idea ?
FileReaderandFileare not JavaScript built-ins. There're Java classes of the same name. Are you interacting with an applet or something else that provides a bridge to a JVM?FileReaderandFileare part of javascript since HTML5 : developer.mozilla.org/en/DOM/FileReader