hello everyone.. Can anyone help me?... How can I make a link for users to DOWNLOAD an image (prompts SAVE AS dialog box) without using Right-click?... (Images are from photobucket.com) Any script? code? Pls help. Thanks a lot in advance.. Gene
You cant dictate if a file is downloaded or displayed as it is down to individuals settings/ preferences/ what they have installed. The easiest way to achieve what you want would be to have the link to a zip'ed version of the image as very few will have web browser pluggins that automatically open zip files rather than giving the dialog box
Send headers indicating it is an attachment, namely "Content-Disposition: attachment; filename=image.gif"
Not 100% reliable but a good suggestion - though you would have to link to a server side page rather than direct to the image as far as I can think you cannot add a header either to a link itself nor an image file directly
It can be done with javascript, but when opening the save-as dialogue the image also opens in a new browser window. The work-around avoiding a new browser window opening is as follows: The save-as script in the header: <script> function SaveFile(fname){ img.document.execCommand('saveas', null ,fname) } </script> Now the trick is to have the image already opened as a new page. To achieve this we put it in an iframe with the image filename as SRC: <iframe id="img" src="myimage.jpg" width="(image width + 20)px" height="(image height + 25)px" scrolling="no" frameborder="0px"></iframe> On the original page we now call the save-as script: <button onclick="SaveFile('myimage.jpg');">save as</button> Does not work in FireFox though.....