window.devicePixelRatio browser support

天涯浪子 提交于 2019-12-04 16:07:01

问题


I have been looking around the web to find what browser support there is for window.devicePixelRatio, without much luck.

Does anyone know what browers/devices support this?


回答1:


According to this blog post : ( from 2012 )

  • window.devicePixelRatio is mostly trustworthy on most browsers.
  • On iOS devices, multiply devicePixelRatio by screen.width to get the physical pixel count.
  • On Android and Windows Phone devices, divide screen.width by devicePixelRatio to get the dips count.

2017 UPDATE:

This property returns the ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device. This value could also be interpreted as the ratio of pixel sizes: the size of one CSS pixel to the size of one physical pixel.

Desktop browsers support:

Chrome    Edge    Firefox    Internet Explorer    Opera    Safari
49        (Yes)   49         11                   41       9.1

Mobile Browsers:

Android     Edge    Firefox     IE Mobile   Opera   Safari Mobile
4.4         (Yes)   ?           ?           all     9.3

Draft Spec



来源:https://stackoverflow.com/questions/16385573/window-devicepixelratio-browser-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!