You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Server-side rendering a hero image can cause double download of the same image when using srcset but not sizes. The problem is: the amp-img extension in that case generates a viewport specific sizes attribute which might cause a re-download of the same image.
Don't generate a sizes attribute for ssr'd img. There's no value in setting this anyway, as the user agent has already decided at this point in time which image to download.
Problem
Server-side rendering a hero image can cause double download of the same image when using
srcset
but notsizes
. The problem is: the amp-img extension in that case generates a viewport specific sizes attribute which might cause a re-download of the same image.Steps to reproduce
Load https://lava-useful-horesradish.glitch.me/ in DevTools simulating a mobile device, e.g. G4. You can see that the image is downloaded twice:
Suggested fix
Don't generate a sizes attribute for ssr'd
img
. There's no value in setting this anyway, as the user agent has already decided at this point in time which image to download.//cc @patrickkettner @jridgewell
The text was updated successfully, but these errors were encountered: