Closed karlcow closed 7 years ago
Client Hints plans to solve exactly this. DPI is relatively easy to ascertain, however image size is much more difficult because the browser's look-ahead pre-parser wants to start downloading images before it's loaded CSS (i.e. before it knows how big the image needs to be). Your best bet for now is to use picture/srcset and request image sizes/dpi based on CSS style media queries (which are based on viewport width), which is definitely an improvement on UA sniffing.
@karlcow thanks for the feedback!
PTAL at the discussions in https://github.com/httpwg/http-extensions/issues/306 and https://github.com/httpwg/http-extensions/issues/307... we're working towards a solution to enable CH signals on the navigation requests there, which will cover the use case above.
(closing this, let's continue on httpwg issues linked above)
@igrigorik During a discussion with a big Web site, they had this context.
window.devicePixelRatio
is not working and client Hints for Image HTTP Request is too late. I guess they built the URI in the template on the server side at the initial request.Do you think client hints would be able to address this use case?