Monday, August 20, 2018

Chrome 45 on Galaxy S6 not choosing right img based on srcSet attribute

Chrome 46 on my desktop loads the right images when i resize the browser to different widths. However on my phone it loads the largest image! the 1024w one. When i go to http://html5test.com/ on my phone it says its supported. Can anyone confirm that it's just not working correctly on mobile?


Solved

Your S6 has a device width of 360 pixels.

Its display has a super-high pixel density of 4x, so a total amount of 4 * 360 = 1440 physical pixels width in portrait orientation. (4 * 640 = 2560 in landscape)

80% of that, as specified in your sizes attribute, is 1152 physical pixels wide, so the your browser is correct in trying to get the largest image you have for that space on such a high-ppi screen.

I hope this helps!


No comments:

Post a Comment