Dec 3, 2019 in JavaScript
Q: How To Read And Write A File Using Java Script?

1 Answer

0 votes
Dec 3, 2019

This can be done in two ways which are discussed below,

1.      Using an ActiveX objects (Internet Explorer only)

Using ActiveX objects, following should be included in the code to read a file

var fso = new ActiveXObject("Scripting.FileSystemObject");

var s = fso.OpenTextFile("C:\\example.txt", 1, true);

2.      By the use of JavaScript extensions which runs from the Java Script editor.

In JavaScript Extensions,

fh = fopen(getScriptPath(), 0); to open a file

Click here to read more about JavaScript
Click here to read more about Insurance

Related questions