This page was created by whygee (at) f-cpu.org , 2006-09-04
Use at your own risks, comments are welcome !
This test page tries to save JavaScript data to a file in your hard disk.
This is normally forbidden (and for good reasons !!!) but sometimes one wants
to save data anyway, particularly with VSPsim.
One could use the cookies but they are limited in size and can't be easily
imported/exported from/to other software.
So I found the following trick :
upon request, this code creates a new (pop-up) window,
then writes the desired data to it. The user (you) simply have to hit 'CTRL+S'
to save the window's contents to the desired file.
Known issues (maybe already solved, but feedback is needed) :
-
Most obviously, the user has to type (a bit) more keys than is usual in other environments.
This is a decent compromise with security.
-
The result certainly varies from platform to platform and it might cause a few problems.
Most notably, i have developped this under Firefox.
-
Don't forget to select "save as plain text" in the save window !
I don't know how to tell Mozilla/Firefox that the type of contents is raw text,
- it wants to add a trailing .htm all the time to the file names
- the default filename is this page itself, it increases the risk of erasing it !
- Finally, for this method to work, please allow the pop-ups for this page.
This could also work with frames, but i'm too lazy.