1

I would like to determine the pixel density of my user's browser.

It seems window.devicePixelRatio works well, however, if the user zooms the browser, the value might be inaccurate, according to this question on SO.

Is there any way that I can tell the pixel density no matter whether a user zooms in/out his/her browser?

AGamePlayer
  • 7,404
  • 19
  • 62
  • 119
  • Does this answer your question? [What are best practices for detecting pixel ratio/density?](https://stackoverflow.com/questions/16541676/what-are-best-practices-for-detecting-pixel-ratio-density) – Heretic Monkey May 09 '22 at 12:20
  • @HereticMonkey I used the function `getDevicePixelRatio` in the latest answer to that question but will get different results in different zooming levels. – AGamePlayer May 27 '22 at 07:43

0 Answers0