Home  >  Article  >  Web Front-end  >  Can Browser Zoom Levels Be Programmatically Controlled?

Can Browser Zoom Levels Be Programmatically Controlled?

Linda Hamilton
Linda HamiltonOriginal
2024-11-27 06:56:10961browse

Can Browser Zoom Levels Be Programmatically Controlled?

Browser Zoom Level Manipulation

Can the zoom level of a browser be modified through code? Reports suggest varying possibilities.

Is Zoom Level Alteration Feasible?

Yes, browser zoom level modification is achievable in Internet Explorer and Chrome but not in Firefox.

Implementation Details

To enable zoom level control using buttons, implement the following:

<script>
   function toggleZoomScreen() {
       document.body.style.zoom = "80%";
   } 
</script>
<img src="example.jpg" alt="example" onclick="toggleZoomScreen()"/>

This code will trigger the toggleZoomScreen() function upon clicking the image, adjusting the zoom level to 80%.

The above is the detailed content of Can Browser Zoom Levels Be Programmatically Controlled?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:My Github ProfileNext article:My Github Profile