tags:

views:

20

answers:

2

Hi,

I have a webapp where my users might want to get some data from me in xml format. The flow I was thinking of:

  1. User clicks a button named "export"
  2. I generate a long xml string using javascript.
  3. Pop up a new window and just paste the xml string into it.

I would prefer saving the xml string into a text file for the user, but I don't think this is possible with javascript (security reasons).

Are there any other best practices for doing something like this? I guess this will work fine,

Thanks

+1  A: 

If you can access server-side pages, you can generate the XML string using javascript, make an ajax call to give the server your string, then make the user download the generated file.

Clement Herreman
+2  A: 

You can add a hovering text field to the page and paste the XML into that. To make things more simple for the user, set the focus to the field and select everything (so they only have to press Ctrl+C).

Aaron Digulla
Quite smart way !
Clement Herreman