Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
API for getting/setting image pixel density #252
Currently the UA "remembers" which DPR variant it picks when making a request and then uses said value to scale the received asset before it's displayed - e.g. if a 2x selector is used, then the image is automatically scaled down by same factor before its displayed.
However, there are cases where what the client chooses, and what comes back (from server, cache, service worker, etc), are not the same:
To address above use cases, we need two things:
referenced this issue
Nov 11, 2014
Yes, I guess there are two different things here, although they are related in terms of API surface...
It's not clear to me that Client-Hints will be adopted by all browsers. I would recommend monkey-patching HTML in the CH spec for the header part for now.
The JS API can be added, but I don't know what behavior you would like it to have. Should the default be a special "auto" value that has today's behavior, and if you set it to a number, that number gets used even if a new resource is selected? Or something else?
@zcorpan monkey patch HTML spec from an IETF doc? Yikes.. If anything, I think it would make sense to do the reverse: move
JS API: I'd expect the query to return the DPR of the current resource; if the resource changes it should return the new value.