Read and write a file using javascript

<<Previous   Next>>

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); 

<<Previous   Next>>
 



Write your comment - Share Knowledge and Experience


 

 
Latest placement tests
Latest links
 
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring