SyntaxFix
Write A Post
Hire A Developer
Questions
You can use the Visual Viewport API:
window.visualViewport.scale;
It is standard and works both on desktop and mobile: browser support.