Is it possible to zoom the browser with code?

6

Is there any way to change the browser zoom with JavaScript ?

When loading script you would like to change the browser zoom to 100%, it can be using any (Angular, jQuery) framework.

I would be very grateful if you could help.

    
asked by anonymous 10.11.2016 / 17:48

2 answers

3

See this answer.

In short you can use:

document.body.style.zoom = 1.0

But this property is not standard for all browsers .

Instead use tranforms:

var scale = 'scale(1)';
document.body.style.webkitTransform =  scale;    // Chrome, Opera, Safari
document.body.style.msTransform =   scale;       // IE 9
document.body.style.transform = scale;     // Geral
    
10.11.2016 / 18:13
1

document.body.style.zoom = "200%"
<p>Olá, mundo!</p>

I tested this code in IE and CHROME. But I believe it to be Cross-Browser.

    
10.11.2016 / 18:08