J
Jeff
Hi,
I'd like to be able to prompt the user to save text that a script has
created to a file.
The idea is that the script would create a text string, the "Save As"
dialog would be triggered and then the user could choose to save the
text that was created somewhere on their local filesystem. This has
none of the security concerns of Javascript being able to write to the
local filesystem but still allows me to customize data to the user.
With Firefox, doing the following almost works, but I haven't figured
out a way to suggest a default filename (Firefox, uses what appears to
be a random string). IE croaks on it.
window.location = "datalain/text,Test";
This prompts me to save the file and when I do the string "Test" is
contained within the file.
Does anyone know how to do this the right way? Hopefully, also in a
cross-browser way?
Thanks!
Jeff
I'd like to be able to prompt the user to save text that a script has
created to a file.
The idea is that the script would create a text string, the "Save As"
dialog would be triggered and then the user could choose to save the
text that was created somewhere on their local filesystem. This has
none of the security concerns of Javascript being able to write to the
local filesystem but still allows me to customize data to the user.
With Firefox, doing the following almost works, but I haven't figured
out a way to suggest a default filename (Firefox, uses what appears to
be a random string). IE croaks on it.
window.location = "datalain/text,Test";
This prompts me to save the file and when I do the string "Test" is
contained within the file.
Does anyone know how to do this the right way? Hopefully, also in a
cross-browser way?
Thanks!
Jeff