Entry
How can I call save as on an IMG/Image?
Mar 31st, 2000 03:16
Martin Honnen,
IE supports
document.execCommand('SaveAs')
to save the current page. It looks as if you can also open a page with
an image in it and then call the command on the image page:
function saveImageAs (imgOrURL) {
if (typeof imgOrURL == 'object')
imgOrURL = imgOrURL.src;
window.win = open (imgOrURL);
setTimeout('win.document.execCommand("SaveAs")', 500);
}
<A HREF="javascript: void 0"
ONCLICK="saveImageAs(document.anImage); return false"
>save image</A>
<IMG NAME="anImage" SRC="whatever.gif">
Note that the img needs to be on the same server as the script.