* kj wrote in comp.lang.javas cript:
>Hi. Suppose that a JavaScript script running on some browser has
some data in a variable (e.g. a large chunk of text retrieved via
Ajax from a remote server). Is there a way for the script to cause
the browser's Open With/Save As dialog to come up to view this
data?
You could try to simulate it by navigating to an address that either has
an unknown internet media type or alternatively a 'Content-Disposition'
header with the right values (e.g., by posting the data to some web site
first). An option for the former could be:
window.location .href = 'data:applicati on/octet-stream,...';
where the ... is the properly encoded data you wish the user to save.
You could also use whatever right mime type you have and have the user
right-click save-as, but I don't think you can trigger that from script.
--
Björn Höhrmann · mailto:bj****@h oehrmann.de ·
http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 ·
http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 ·
http://www.websitedev.de/