Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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

You are here: irt.org | FAQ | JavaScript | Source | Q1772 [ previous next ]

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

©2018 Martin Webb