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 trial

JavaScript jQuery Basics Working with jQuery Collections Changing Element Properties

Su Deng
Su Deng
1,226 Points

the 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
Richard Eldridge
8,229 Points

After 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.

@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.

Su Deng, please mark a response as the answer to your question.

Roger Hwang
Roger Hwang
3,851 Points

I 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?

I found that if you write the following code:

$pdfs.attr('target', 'download');

It download the file...