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 trialammarkhan
Front End Web Development Techdegree Student 21,661 PointsWhat is wrong with my code?
I tried doing the challenge on my own but it didn't work, upon seeing how treasure did it, my code seems same but still not working. I am using chrome.
const pdf = $('a[href$=".pdf"]');
pdf.attr("download",true);
2 Answers
Richard Eldridge
8,229 PointsAccording to caniuse.com, the download attribute is supported; however, it is "ignored" on cross-origin links on the newest versions of Chrome. I believe that is the source of the problem. I am having the same issue.
Edit: Alan M. posted a solution on a different post that worked for me.
Steven Parker
231,236 PointsThere's nothing obvious in this little snippet, perhaps the problem is elsewhere. You can share your entire environment if you make a snapshot of your workspace and post the link to it here.
Also, when you say "not working", exactly what are you doing and what do you expect to happen?
Richard Eldridge
8,229 PointsRichard Eldridge
8,229 Pointshttps://caniuse.com/#search=download
Click on the "Known Issues" tab, and you will see what I was talking about.
Steven Parker
231,236 PointsSteven Parker
231,236 PointsThat explains the problems with Firefox or Chrome. Could you provide a link to the post with the solution by Alan M.?