Page 1 of 1

Save As Image Problem in Mozilla Firefox

Posted: Wed Mar 22, 2006 2:55 am
by sanketce
Below code works correctly in IE but produces an error in IE what is wrong with this.

Code: Select all

function saveImageAs (imgOrURL) 

	if (typeof imgOrURL == 'object')
		imgOrURL = imgOrURL.src;
	// = open (imgOrURL);
	setTimeout('window.document.execCommand("SaveAs")', 500);

<a href="#" onclick="saveImageAs(document.frm.anImage); return false;" class="bottom_text">Save Image</A>

Posted: Wed Mar 22, 2006 2:57 am
by sanketce
Above code doesnt work in mozilla.

Posted: Sat Apr 01, 2006 10:55 am
by Alexej Kubarev
window.document.execCommand("SaveAs") is the problem im not sure that you willb e able to do that...

Posted: Sun Apr 02, 2006 4:56 pm
by gesf
Try running execCommand outside the setTimeout. Or... put no timeout.

Posted: Sun Apr 02, 2006 9:32 pm
by sanketce
I think execCommand("SaveAs") is not supported by Mozilla.... what is your view?

Posted: Sun Apr 02, 2006 11:06 pm
by Alexej Kubarev
pretty much what i thought.. however look at as they have the documentation for everything that has to do with JS and Mozilla

Posted: Mon Apr 03, 2006 12:24 am
by sanketce
Thanks for your suggestion :)