Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSu Deng
1,226 Pointsthe download thing doest work for me
i tried to copy the code in this video for $pdfs.attr('download', true);
but it doest download for me, it just opens the page.
6 Answers
Richard Eldridge
8,229 PointsAfter checking out the known issues on caniuse.com it appears the newest versions of Chrome no longer support this feature. The graphic indicates that the "download" attribute is supported; however, it appears that it is now "ignored" for cross-origin links.
Edit: Alan M. posted a possible solution on another post that worked for me.
Joseph Wasden
20,406 Points@3:14 in the video, "A quick note here, some older browsers don't support the download attribute, and if you're using Firefox, the download attribute won't trigger if the PDF points to an external website."
Here's a list of what supports (and doesn't support) the download attribute.
https://caniuse.com/#search=download
something to consider.
Jeff Sanders
Courses Plus Student 9,503 PointsSu Deng, please mark a response as the answer to your question.
Dilip Agheda
Full Stack JavaScript Techdegree Graduate 28,581 PointsNeither "download" nor "target='download'" works in new version of Chrome. looks like its not supported anymore.
Roger Hwang
3,851 PointsI have Chrome version 70 and caniuse.com says it supports the download attribute, but not cross-origin links? Basically when the site you're downloading from is not from the site you're currently on?
richi rivas
370 PointsI found that if you write the following code:
$pdfs.attr('target', 'download');
It download the file...
Dave Harrison
Front End Web Development Techdegree Student 7,400 PointsDave Harrison
Front End Web Development Techdegree Student 7,400 PointsRichard,
Would you be able to share a link to the Alan M. post as I can't find it?
Tomasz Grodzki
8,130 PointsTomasz Grodzki
8,130 PointsIf someone still looking for Alan's post, here it is: https://teamtreehouse.com/community/jquery-attr-method-for-download-not-working