Sidharth Sidharth - 1 month ago 6
HTML Question

Disable zoom in browser JS

I am a beginner and i am learning javascript.

I have a doubt, is it possible to disable the browser zoom which exists in the menu section of the browser. I have been able to disable the zoom that occurs when using ctrl + mouse scroll and any key event that occurs. But is there a way to disable / a way to block the browser independent zoom options given in their respective menus.

Thanks in advance!

Regards,
Sidharth

Answer

I believe that it is not possible to achieve this, seeing as most browser zoom functions are most definitely hard coded and forced.

The only (cheaty/somewhat regretful) solution that I've seen being used is the following:

  <script>
      document.firstElementChild.style.zoom = "reset";
  </script>

(Which you could easily put as css too). Disabling zoom is not the best solution. Especially if the project that you are working on possibly consists of a lot of text. Zooming function adds readability and increases accessibility to your website, especially for aid of those with bad sight.

Comments