How do I programmatically determine the current zoom level of a browser window?

Posted by Mihai Fonoage on Stack Overflow See other posts from Stack Overflow or by Mihai Fonoage
Published on 2010-05-11T15:41:38Z Indexed on 2010/05/11 15:54 UTC
Read the original article Hit count: 370

Filed under:
|
|

Hi,

I want to find out the zoom level of what is being displayed in a browser window based on the javascripts' window object properties (http://www.javascriptkit.com/jsref/window.shtml) to which I have access. I just can't seem to find the right mathematical formula for the zoom based on the inner width, page offset, etc. I found a solution, but that uses the document.body.getBoundingClientRect call which does not return anything in my case and for which I can't tell if there's a suitable replacement from the window properties. I am using Safari.

Thank you, Mihai

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about browser