How do I prompt user to save text (xml) to a file?

By default, you can't. Browser isn't supposed to access your local disks for security reasons.

By default, you can't. Browser isn't supposed to access your local disks for security reasons. But, if you can ask your user to change it's security settings (and you should not to ask), you can to use FileSystemObject or even your Microsoft.XMLDOM.

Save method.

You cannot do it with 100% client-side JavaScript with the default security settings. You'll need to implement some server-side logic. In your case, you'll be able to do the XML transformation server-side, as well.

bigresource.com/Tracker/Track-javascript... support.microsoft.com/kb/q260519.

You could construct a data: URI with a media type of application/octet-stream. Function download (data, charset) { if (!charset) { charset = document. CharacterSet; } location.

Href = "data:application/octet-stream;charset=", charset, ",", encodeURIComponent(data) . Join(""); } All browsers except IE support data: URIs. I think IE8 may support them, but only for images.

For IE, a workaround could be to send the data to a server (including document. CharacterSet) and then load a page that has something like the following header: Content-Type: application/xml; charset={document. CharacterSet} Content-Disposition: attachment If you want to give the file a name too, use Content-Disposition: attachment; filename=.... Also, for any of this to work, you have to convert your XML to a string first.

I do this with code snippets on my blog (user can click on the save button, and the snippet will come up in their default text editor, where they can tweak it and/or copy it into their app). It works by putting all the textual data inside of a hidden field, and then submits it to a very simple server-side HTTP handler. The handler just grabs the hidden field value and spits it right back out in the response with the right content-disposition header, giving the user the open/save download prompt.

This is the only way I could get it to work.

You cannot do it with 100% client-side JavaScript with the default security settings. You'll need to implement some server-side logic. In your case, you'll be able to do the XML transformation server-side, as well.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions