Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web Development
Expertise: Beginner
Nov 5, 1999

Write Text Files to the Client

Question:

I'm trying to figure out a way to pass along a questionnaire built in HTML so that users can fill it out in their browser, then have the answers written to a local text file on the users' PC. Is that possible through scripting? (I know you're asking the obvious question of why this is not happening via a Web site. Well I don't have a site yet, so I have to find some way to gather data from disparate locations, and not have to have someone rekey results from hardcopy.)

Answer:

For security reasons, client-side scripting languages are devoid of the capability to read and write files on the client. However, there are a couple of possible workarounds. Because client-side script languages can write to cookies on the client, you could use that mechanism as a stopgap measure until you get a Web server. Remember that cookies have limitations, including a 4 KB maximum size, so they aren't really designed for the type of use that you mentioned. But if you really have no other alternative, you could get them to work.

Another alternative is to use the Microsoft FileSystemObject from within client-side script. Using this object, you can create and read files. To use this object, however, you must ensure that the object is installed on the computer where you want this functionality.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date