简体   繁体   中英

How to forcefully download image in IE instead of open

I want to download image in IE with tag but instead of download it gets open in new tab. But IE did not support to HTML5 tag. Is there any solution so we can directly download image instead of open. I want to use only HTML and js because my application is customized web site in which SAS, html and JS is used.

Download attribute doesnt support in IE http://caniuse.com/#search=download%20attribute

you have to fixed this thing in server side if you are on apache server, use below code in .htaccess file

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{QUERY_STRING} fdl=1
RewriteRule .? - [T=application/octet-stream]

then it will work for you, hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM