Archive

Archive for the ‘without mouse’ Category

“Save Image As” without Right Click using Javascript

March 26th, 2007 Arun Manivannan 2 comments

<script>
function saveImageAs (imgOrURL) {
if (typeof imgOrURL == ‘object’)
imgOrURL = imgOrURL.src;
window.win = open (imgOrURL);
setTimeout(’win.document.execCommand(”SaveAs”)’, 500);
}
</script>

<A href=”#”
ONCLICK=”saveImageAs(document.getElementById(’embedImage’)); return false” >save image</A>

<img id=”embedImage” src=”impossible.jpg” >
I am not the author of this code and i am really not sure where i picked up this script. But it works too good… only on IE