本文介绍了window.devicePixelRatio浏览器支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在网上寻找 window.devicePixelRatio 的浏览器支持,没有太多运气。

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?

推荐答案

根据博文:(自2012年起)

According to this blog post : ( from 2012 )


  • window.devicePixelRatio 在大多数浏览器上最值得信赖。

  • 在iOS设备上,乘以 devicePixelRatio screen.width 获取物理像素数。

  • 在Android和Windows Phone设备,按 devicePixelRatio 划分 screen.width 以获得逢低计数。

  • 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更新:

桌面浏览器支持:


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

移动浏览器:


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

这篇关于window.devicePixelRatio浏览器支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 15:04