Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Brandon Gormley
6,147 PointsDownload Button will only open in browser?
Hey guys,
My goal is to click a Download Button which I have made and then have my resume download to the user's computer. Currently it will only open up in the browser.
Anyone know how to fix?
-Thank you,
<div class="resume"> <h2>Resume</h2> <p>Please feel free to download my resume below:</p> <a class="resumebutton" href="resume/resume.pdf" download="Resume">Download</a> </div>

Brandon Gormley
6,147 PointsHmmm, didn't seem to work :/

Martin Jones
Front End Web Development Techdegree Graduate 43,232 PointsOK, could be worth checking if your browser can use this attribute using the link below:
https://caniuse.com/#feat=download
If not, please post the updated HTML your are using and I will take a look
1 Answer

Sean T. Unwin
28,660 PointsDepending on your web server, you may have to set the Response Headers.
For example, if you are using Apache you may set the following in an .htaccess
:
AddType application/octet-stream .pdf
There are other ways to perform essentially the same, i.e. setting the headers, programmatically in whichever language you are using on the server.

Brandon Gormley
6,147 PointsWhere would I add this to in the html?

Sean T. Unwin
28,660 PointsIt wouldn't go in your HTML as it's a web-server configuration to force downloads for particular file types. This is because Response Headers are sent from the web-server.
Martin Jones
Front End Web Development Techdegree Graduate 43,232 PointsMartin Jones
Front End Web Development Techdegree Graduate 43,232 Pointsjust change
download="Resume"
to just
download
and you will be OK.
Hope this helps,
Further info is available at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes