1readTextFile("file:///C:/your/path/to/file.txt");
2
3function readTextFile(file)
4{
5 var rawFile = new XMLHttpRequest();
6 rawFile.open("GET", file, false);
7 rawFile.onreadystatechange = function ()
8 {
9 if(rawFile.readyState === 4)
10 {
11 if(rawFile.status === 200 || rawFile.status == 0)
12 {
13 var allText = rawFile.responseText;
14 alert(allText);
15 }
16 }
17 }
18 rawFile.send(null);
19}