HTML - How
to read and write a file using javascript? - August 12, 2008 at 18:00
PM by Amit Satpute
How to read and write a file using javascript?
There are two ways to do
it:
1. Using JavaScript extensions (runs from JavaScript Editor), or
2. Using a web page and ActiveX objects (Internet Explorer only)
In JavaScript Extensions, you can use
fh = fopen(getScriptPath(), 0); to open a file
Using ActiveX objects, following should be included in your code to read a file:
var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile("C:\\example.txt", 1, true);
|