Here is the code.
On click of the link , the save as dialog should open
<a href="http://www.experts-exchange.com/xp/images/newNavLogo.png" target="_new">
<img src="http://www.experts-exchange.com/xp/images/newNavLogo.png" align="left" alt="" />
</a>
How can we achive this using jQuery, or javaScript?
If you are using PHP or any other platform you can always use the force download technique.
This might help:
<?php
$file = 'tag_cloud.gif';
if(!file){
// File doesn't exist, output error
die('file not found');
}else{
// Set headers
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$file");
header("Content-Type: image/gif");
header("Content-Transfer-Encoding: binary");
// Read the file from disk
readfile($file);
}
?>
Call the above script as ajax in the click event of image.
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With