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,224 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.

Joseph Wasden
Joseph Wasden
20,373 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
PRO
Jeff Sanders
Pro Student 7,100 Points

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

Dilip Agheda
Dilip Agheda
Full Stack JavaScript Techdegree Graduate 28,573 Points

Neither "download" nor "target='download'" works in new version of Chrome. looks like its not supported anymore.

Roger Hwang
Roger Hwang
3,848 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...