Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

287
Views
Who to control browser level zoom that should work with all cross platform browser

I am looking for JS script to control browser's zoom.

I have tried the "document.body.style.zoom", but this doesn't work with Firefox.

Thanks you.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The browser's zoom level cannot be controlled via JavaScript, fortunately. It's a user-controlled setting.[1]

The zoom CSS property indeed does a similar thing - not only it scales the element but it also scales it's rendered size, affecting the page's layout. However, unlike changing the browser's zoom level, the zoom property does not affect media queries (tested on Chrome) so even if applied to the <html> or <body> element the result may be different than changing the browser's zoom. The other problem is that the zoom property is not standard and not supported cross-browsers.

An alternative is to apply a transformation like transform: scale(2); or transform: scale(0.5); . However transformations only change the element visually and not the rendered size, so you will need to handle that too. The following code seems to mimic a zoom level of 50% reasonably:

:root {
    width: 200%;
    transform: scale(0.5);
    transform-origin: 0 0;
}

[1] It can be controlled by browser extensions privileged JS, but that's out of question. There is also a <meta> tag setting that controls zoom level but it's only for smartphones and can also be overriden by browser settings.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!