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 trialJuneau Lim
13,362 Pointstarget _blank & download not working
const $odd = $('a:odd');
const $secureLinks = $('a[href^="https://"]')
const $pdfs = $('a[href$=".pdf"]')
$secureLinks.attr('target','_blank');
$pdfs.attr('download', true);
Have no idea why. :-( I'm using chrome and cleared cash.
Nelson J
7,411 Points1 Answer
Kristaps Vecvagars
6,193 PointsChanging settings in Chrome activated the download feature, however, it seems the download attribute has no bearing on the behavior, at least for .pdf files. Is this true or not?
Juneau Lim
13,362 PointsThank you very much for your kind answer Kristaps. I'll try it as soon as I got a bit sane. I'm out of my mind right now due to the start of the new semester. But your advice definitely sounds promising. I really appreciate your kindness.
Katiuska Alicea de Leon
10,341 PointsThank you! Which settings, exactly?
John Nguyen
Full Stack JavaScript Techdegree Graduate 30,501 PointsThank you, this needs to be added as a note on the video.
Robin Siegl
11,157 PointsRobin Siegl
11,157 PointsSo i tested this course and got the same error with the download property, but the target _blank does work for me.
I also logged the the variables to the console to see if it assigns the right attributes (it does).
My Code: