| | #1 |
| Warrior Member Join Date: 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
Hello, I was wondering if anyone knew how I could create a downloadable img link? I'm working on a website and when a person clicks the download button I would like it to download the image they clicked to their computer. How would I do this? If anyone could explain or give me some coad examples I would really appreciate it. ![]() Thanks |
| |
| | #2 |
| Dev4Hire War Room Member Join Date: 2011 Location: Missouri
Posts: 104
Thanks: 30
Thanked 30 Times in 16 Posts
| Code: <a href="/path/to/image" download="imagename"><img src="/path/to/image" /></a> Example Code: <a href="http://upload.wikimedia.org/wikipedia/commons/3/3f/Stephenson%27s_Rocket_drawing.jpg" download="myimage"><img src="http://upload.wikimedia.org/wikipedia/commons/3/3f/Stephenson%27s_Rocket_drawing.jpg" /></a> |
| |
| | #3 |
| Advanced Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,907
Thanks: 236
Thanked 1,377 Times in 676 Posts
|
FYI... the "download" attribute is not supported in IE and a few other browsers (see this for compatibility). So if you want a cross-browser solution, the easiest way is to just put the image in a zip file, and link to that. Or use Modernizr if you want the "download" attribute to work in all browsers... Modernizr Download Builder There are a few other ways to force downloading of images (via htaccess or php), but they are more complicated than the above 2 options. |
| | |
| |
| The Following User Says Thank You to Brandon Tanner For This Useful Post: |
| | #4 |
| Dev4Hire War Room Member Join Date: 2011 Location: Missouri
Posts: 104
Thanks: 30
Thanked 30 Times in 16 Posts
|
That's true. However, only 11.8% of web traffic comes from IE. And IE 11 DOES support the download tag. If the user is using IE (and I hope nobody does) they should be updated to 11. God knows M$ pushes those updates on you until you fold. Stat via w3schools |
| |
| | #5 |
| Advanced Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,907
Thanks: 236
Thanked 1,377 Times in 676 Posts
|
Only 11.8% of W3School's traffic comes from IE. My own stats show a roughly similar figure for my internet marketing & tech-related sites, but for some of my sites in other niches, IE visitors still account for over 20% of the overall traffic. And the vast majority of them are not on IE11... most are on 8/9/10. I don't like IE any more than you do, but IMO there are still way too many IE users out there to ignore them (especially when they are clicking on the "buy" button ).
|
| | |
| |
| The Following 2 Users Say Thank You to Brandon Tanner For This Useful Post: |
| | #6 | |
| ɹoıɹɹɐʍ ǝʌıʇɔɐɹǝdʎɥ War Room Member Join Date: 2008 Location: Texas
Posts: 2,138
Thanks: 243
Thanked 453 Times in 382 Posts
Blog Entries: 3 |
| |
|
Robin | ||
| |
|
| Bookmarks |
| Tags |
| downloadable, img, inserting |
| |