Делаете скрипт с заголовками:
Например php:
$fileUrl = isset($get['file']) ? $get['file'] : null;
$filePath = ($fileUrl) ? $_SERVER['DOCUMENT_ROOT'] . '/' . $fileUrl ? null;
if (file_exists($filePath)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($filePath);
}
И уже на него делаете редирект
location.href = "скрипт.php?file=image/img.jpg";