window.devicePixelRatio浏览器支持 [英] window.devicePixelRatio browser support

查看:588
本文介绍了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更新:


此属性返回物理像素的分辨率与铜的CSS像素的分辨率之比显示设备。此值也可以解释为像素大小的比率:一个CSS像素的大小与一个物理像素的大小。

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.

桌面浏览器支持:


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浏览器支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆