Force Download an Image Using Javascript

You need to use server-side scripting for this. Search on stackoverflow. Alternately, your server might allow you to alter headers dynamically via configuration. Apache solution with mod_headers Place your downloadable images in a directory. Inside this directory, create a .htaccess file with the following contents: SetEnvIf Request_URI “([^/]+\.jpg)$” REQUESTED_IMAGE_BASENAME=$1 SetEnvIf Request_URI “([^/]+\.png)$” REQUESTED_IMAGE_BASENAME=$1 Header set … Read more