W3C home > Mailing lists > Public > public-css-archive@w3.org > September 2016

Re: [csswg-drafts] [cssom-view] Should browser zoom affect screen.width?

From: Demitrius via GitHub <sysbot+gh@w3.org>
Date: Mon, 05 Sep 2016 20:58:57 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-244810763-1473109135-sysbot+gh@w3.org>
I study task to get the zoom level.

Where is no universal, simple way.

I found one simple way to get zoom factor, just `screen.width / 
window.innerWidth`
This works in Chrome and Safari couse screen.width not affects while 
zooming at this browsers.

In IE, developers use `screen.deviceXDPI / screen.logicalXDPI`

For FireFox developers use CSS.
Add new style sheet, add media rule, check element, remove all back, 
details can be found here
[Detect 
Zoom](https://github.com/tombigel/detect-zoom/blob/master/detect-zoom.js)

It would be better to make more ease way to get zoom factor.
For example, window.zoomFactor variable.

-- 
GitHub Notification of comment by Demitrius
Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/399#issuecomment-244810763 
using your GitHub account
Received on Monday, 5 September 2016 20:59:05 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:02 UTC