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 trialPaula Mourad
5,154 PointsIs there any relation between picturefill and srcset?
Hey guys,
I'm a little confused here :) I understand that picturefill is a JS script that you add to your html file, in case browsers don't read this feature. What feature are we talking about?
Whenever I use the srcset, do I have to add the picturefill JS script?
Thanks! :)
1 Answer
Manav Misra
11,778 PointsPicturefill is a 'polyfill' for the srcset attribute. It 'manipulates' non-compliant browsers into following "srcset" via JS.
As you see here: http://caniuse.com/#search=srcset "srcset" may not be 'fully' compatible. So, your site may not display images as you might expect them too if you solely rely on "srcset."
Therefore, if you include picturefill.min.js, you will help to maximize the experience for more users.
Finally, you should also include a standard "src" attribute after "srcset" for those rare situations where a user might be using a non-compliant browser AND have JS disabled, although that's pretty ridiculous in this day and age.