/    Sign up×
Community /Pin to ProfileBookmark

make JPG’s download without opening?

Hi all—

I want viewers to be able to download text and jpg files from my website. There’s no problem with the text files, which download when the viewer clicks on the link; but when you click on the link to a JPG file, up pops the image. How do I get the JPG to download to the viewer’s computer without opening in the browser?

Here’s the code for a text file link:
<a href=”text.doc”>text document</a>

Using the same code for a JPG file, the image loads into the browser rather than downloading:
<a href=”puppy.jpg”>puppy pic</a>

Thanks for any suggestions.

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@rpgfan3233Feb 21.2009 — You can use what appears to be one of the most underused attributes in HTML:
&lt;a href="puppy.jpg" [color=blue][b]type="application/octet-stream"[/b][/color]&gt;puppy pic&lt;/a&gt;

Be aware that it is really only a hint; it isn't always reliable. It appears to work in IE8 RC1, Firefox 3.0 and Google Chrome. It doesn't appear work in Opera 9, and I haven't tested in Safari since it isn't on this computer.
×

Success!

Help @Scrablero spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...