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 patible with all the browser I tried.
Is there a more general method, or a jquery library to achieve that?
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 patible with all the browser I tried.
Is there a more general method, or a jquery library to achieve that?
Share Improve this question asked Feb 23, 2015 at 14:51 user3098549user3098549 1,2593 gold badges14 silver badges26 bronze badges 3- Did you had any luck? – jason Commented Jul 16, 2015 at 0:52
- 1 Possible duplicate of How to detect page zoom level in all modern browsers? – ZachB Commented Oct 19, 2018 at 23:23
- This might be helpful: sitelint./blog/detect-browser-zoom-level – Cezary Tomczyk Commented Nov 16, 2023 at 20:41
1 Answer
Reset to default 6It 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 pensate the higher pixel resolution.