How to create a xml file on the client machine using javascript or jquery. I need to write the xml file on the clients machine from my web application using javascript or jquery. How can i do so? and need it for atleast 3 browsers Firefox,Chrome and IE8+
-
1you can create the file on server and make it downloadable for the clientRafay– Rafay2011-09-06 12:26:04 +00:00Commented Sep 6, 2011 at 12:26
-
Actualy here is described how to use jQuery for creating XML content. But I'm not sure if it's possible to write it to the file.Samich– Samich2011-09-06 12:29:08 +00:00Commented Sep 6, 2011 at 12:29
-
Thanks for the answer but actually i need it to let my application work offline, and i dont need my data to be lost by clearing cache, so cannot use html5deepmoteria– deepmoteria2011-09-06 12:42:15 +00:00Commented Sep 6, 2011 at 12:42
Add a comment
|
2 Answers
Creating files on the client side is not well supported in many browsers. The trick is to generate a string containing your XML, then encode it using base64 encoding, and redirect the browser to a data: URL which contains this base64 encoded data.
It is easier to create your file on the server and let the user download it.
1 Comment
deepmoteria
Thanks for the answer but actually i need it to let my application work offline, and i dont need my data to be lost by clearing cache, so cannot use html5