detect retina (HD) display on the server side

后端 未结 3 1573
我在风中等你
我在风中等你 2020-12-06 04:31

I found many questions about Retina Display, but none of the answers were on the server side.

I would like to deliver a different image according to the screen, ex (

3条回答
  •  臣服心动
    2020-12-06 05:33

    As you do not specify for what exact use-case you are needing this and i do not really see a use-case for the server knowing what resolution the client wants it's images in (in my opinion the client should decide) here is my suggestion:

    Use something like Retina.js or use the srcset attribute

    This way you could also leverage browser caching of the images. which you can't do if you have one url for two different image sizes. Even if its an automatically created/updated image caching works using last-modified or etag headers.

提交回复
热议问题