H
HaJo
JS-rookie here... Apologies first, I guess this must have been asked a
million times. I googled back&forth, but all the answers I saw were
somehow drifting into different directions, not providing a
solution... Here's the problem:
I have a client-side javascript running, the user creates some data.
At a point the data should be saved to his HDD -- I.e. a "Save as...".
Format of the data, btw, is XML. I couldn't find any pointer on how to
do this client-side only, cross-browser/OS. Any idea how this can be
achieved?
If not possible, I'm thinking whether I should submit the data back to
the server into a cgi/php, temporarily storing the file on the server.
I guess the javascript could then pop a new window open, linking to
the server-side script. That one could then serve the file, hopefully
triggering a "Open/Save" dialog box of the browser. But here I'm not
sure how to create, from the JS, a unique ID identifying the correct
handle for the cgi/php. I worry about race-conditions...
I'm currently asking the user to copy&paste the XML data into a new
document and save that. But that's probably the most user-unfriendly
way I could come up with
Hints or thoughts are highly appreciated!
//hajo
million times. I googled back&forth, but all the answers I saw were
somehow drifting into different directions, not providing a
solution... Here's the problem:
I have a client-side javascript running, the user creates some data.
At a point the data should be saved to his HDD -- I.e. a "Save as...".
Format of the data, btw, is XML. I couldn't find any pointer on how to
do this client-side only, cross-browser/OS. Any idea how this can be
achieved?
If not possible, I'm thinking whether I should submit the data back to
the server into a cgi/php, temporarily storing the file on the server.
I guess the javascript could then pop a new window open, linking to
the server-side script. That one could then serve the file, hopefully
triggering a "Open/Save" dialog box of the browser. But here I'm not
sure how to create, from the JS, a unique ID identifying the correct
handle for the cgi/php. I worry about race-conditions...
I'm currently asking the user to copy&paste the XML data into a new
document and save that. But that's probably the most user-unfriendly
way I could come up with
Hints or thoughts are highly appreciated!
//hajo