最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - window.devicePixelRatio browser support - Stack Overflow

programmeradmin0浏览0评论

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?

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?

Share Improve this question edited Dec 19, 2013 at 20:55 Drew Noakes 312k170 gold badges698 silver badges765 bronze badges asked May 5, 2013 at 14:32 ccdaviesccdavies 1,6065 gold badges22 silver badges33 bronze badges 2
  • if you need to support the newer iOS or androids, then this should work. Logically I would say any device with a pixel ratio that is greater than 1 should support this, but who knows... what do you need to do? Perhaps there are other ways to solving your problem – Huangism Commented Dec 19, 2013 at 21:05
  • I think we can use Mozilla MDN for check browser patibility. It has contain both web & mobile – Jaydeep Mor Commented Jan 11, 2020 at 12:30
Add a ment  | 

1 Answer 1

Reset to default 9

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

发布评论

评论列表(0)

  1. 暂无评论