Write Text Files to the Client


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


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.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: