Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1772 How can I store a file on the client side and read it from my page?

irt.org | Knowledge Base | JavaScript | Source | Q1772 [ previous next ]

Q1772 How can I store a file on the client side and read it from my page?

JavaScript can't read file on the client side ... except if the file is included as another JavaScript file. For example, you might want each of your clients to have a file containing particular data, like their login and password, and then read it from your page in JavaScript to log them automatically to your site.

On each client side, create a file named for example "C:\data.js", containing :

login  = "my login";
passwd = "my password";

Then include this client JavaScript file into your page:

<SCRIPT SRC="C:\data.js"></SCRIPT>
<SCRIPT>
alert("Your login is : " + login + "\nYour password is : " + passwd);
</SCRIPT>

Submitted by Stephane Pepin

The following was submitted by Davidj

how to do it in vbscript -

Function CreateFile()

set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("C:\"mytextfile.epc", True)

a.WriteLine (form1.field1.value)

End Function

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.