Hi all,
I have a JavaScript function which obtains some raw image data from a SWF object. I can’t modify the Flash object itself so I need to find some other way of invoking a file download dialog.
I have managed to output the data to the browser using document.write() and dumping it to an <img> element, but what I would really like is for the user to be able to click a link on the page that then calls the JavaScript function which obtains the raw data (as is already done in the existing code). I’d then like to be able to output the data in such a way as to invoke a Save File dialog (and if at all possible stay on the original page).
I’ve tried using code like
[code]document.open( ‘image/jpg’ );
document.write( image_data );
document.close();
but that shows the image data in text form. (Though I checked the headers and there is probably something wrong with this because the Content-type is being set to text/plain.)
Is such a thing possible? If not, are there any viable alternatives? (It seems a waste to post the data to the server and then dump it back out if the data is already present on the client-side.)
Any help appreciated. Thanks.