How can I detect the page zoom level in all modern browsers? While this thread tells how to do it in IE7 and IE8, I can\'t find a good cross-browser solution.
>
Basically, we have:
window.devicePixelRatio
which takes into account both browser-level zoom* as well as system zoom/pixel density.vw
/vh
CSS unitsresize
event, which is triggered upon zoom level change, cause effective size of the window changesthat should be enough for normal UX. If you need to detect zoom level that might be a sign of bad UI design.
Pitch-zoom is harder to track and is not considered currently.