[thelist] Grabbing output from js to a file

Keith cache at dowebscentral.com
Tue Jan 7 23:56:01 CST 2003


At 10:43 PM Tuesday 1/7/2003, you wrote:
>I have a webpage with a series of forms, all javascript and created on
>the fly. At the end of this test, I aggregate all the user input and
>display it on the screen, but would now like to grab it and store it in
>a file (as a comma seperated list (CSV)).

As long as your javascript page is running in the browser it cannot write
to the client's hard drive. That would be a major security breach.

But there may be two alternatives for you. Microweb and HTA.

Microweb is a fully functional Perl enabled webserver (Apache) that sets on
a CD. The microweb program takes your page, or an entire website, and
builds it's server on the cd with the page or website as it's default.
Insert the cd and the user's default browser opens with your page/site in
it with a madeup URL like http://myTests.cdrom. Microweb cd sites support
htaccess, SSI, MySQL etc. So, a perl script on the microweb could receive
your forms and write them to the hard drive. I have a site that is
distributed this way in demo form to prospective clients. I've never tried
writing to the hard drive with a perl script but microweb's documentation
says it writes to aliased hidden files in the Windows directory. The price
is a bit heavy but you can make unlimited CDs so it may be worth it. I
believe microweb is a Windows only solution.
http://www.indigostar.com/microweb.htm

The other option is to not run your page IN the browser but ON the browser.
It requires IE5+ be installed on Win/Nix/Mac although your user will never
see IE. Change the file's extension from .html (or whatever) to .hta . That
creates a HyperTextApplication. You need to add HTA:Application headers to
the file but it's a simple set. The thing is, you can double click an HTA
file (or shortcut) and it launches just like any windows app, with almost
the same write-to-hard drive privileges that any app on the machine has (it
can write text but not binary). It has such privileges because it is an
app, not a webpage. The HTA is running ON the Explorer browser, IE never
gets launched, it just functions invisibly in the background. I've turned
complex JavaScript/DHTML pages into functional HTAs with no other changes
than the HTA header. You can put the HTA in an installer program like
installshield if you want, or let people download it in a zip. There's an
excellent tutorial on HTAs at
http://www.vbwm.com/articles/2002/abarfield/hta01/ . You can have your
first javascript powered application running in an evening (at no expense).


Keith
====================
cache at dowebscentral.com




More information about the thelist mailing list