javascript - clickable image with save as option -



javascript - clickable image with save as option -

ive got images on website. create functionality if user clicks on image save window appear , 1 can save image.

i wrote this:

<a href="/foto1.png" target="_blank"> <img src="/foto1.png" alt="" /> </a>

and works opens new tab till user clicks save or close save window. possible rid of new tab ?

thanks suggestions

i alter mark , include images want saved in 1 container, work in ie i'm afraid so:

<div id="imagestosave"> <a href="/foto1.png" target="_blank"> <img src="/foto1.png" alt="" /> </a> </div>

then jquery utilize code:

$('#imagestosave img').click(function(){ document.execcommand('saveas',true,'file.html'); });

for browsers, you'll want think craig stuntz:

hyperlinking img file , setting content-type , content-disposition headers in server response. try, e.g., application/x-download, plus other headers specified here.

good luck

javascript jquery asp.net html

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -