I was wondering if there's a way to detect the page zoom level which is supported by all modern browsers. I've already tried this: how-to-detect-page-zoom-level-in-all-modern-browsers
but unfortunately it is not fully compatible with all the browser I tried.
Is there a more general method, or a jquery library to achieve that?
It depends on what your goal. If you only need the current scaling you can use:
window.devicePixelRatio
But the value is not equal to the zoom level on all devices because on HighDPI devices (4k Display, Smartphone, …) the start value is not 1 because there is a default zoom to compensate the higher pixel resolution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With