Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amp-img ssr: don't generate sizes attribute #32644

Closed
sebastianbenz opened this issue Feb 12, 2021 · 0 comments · Fixed by #32647
Closed

amp-img ssr: don't generate sizes attribute #32644

sebastianbenz opened this issue Feb 12, 2021 · 0 comments · Fixed by #32647

Comments

@sebastianbenz
Copy link
Contributor

Problem

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.

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:

Screenshot 2021-02-12 at 22 38 04

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment