Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent desktop browser (Chrome, Safari) from zooming a webpage

I have tried using the following meta view port tag to prevent browser zooming:

<meta content='width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,target-densitydpi=device-dpi' name='viewport' />

This doesn't work though. I know that it is possible because my zooming is blocked on this website: futurism.xyz

The viewport tag for that website is this:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

What am I doing wrong or missing?

like image 794
thundergolfer Avatar asked Feb 05 '16 04:02

thundergolfer


People also ask

How do I stop web pages from zooming in?

By default, Chrome sets the zoom level to 100%. To manually adjust the settings, use the Ctrl key and “+” or “-” combos to increase or decrease the page magnification. If you are using a mouse, you can hold down the keyboard Ctrl key and use the mouse wheel to zoom in or out.

How do I stop my desktop from zooming in HTML?

To disable pinch-zoom in HTML, simply add <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> to the <head> section.

How do I restrict zoom in HTML?

Giving a meta tag attribute "user-scalable=no" will restrict the user from zooming elsewhere. Prevent zooming all together by adding this meta tag to your head tag. This tells the mobile browser to use the same width scale and will not allow the user to zoom in at all, hence also disables that annoying behavior.


2 Answers

Try this:

<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />

or this:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
like image 107
G4bri3l Avatar answered Oct 04 '22 15:10

G4bri3l


You could use css.

body {
    touch-action: none;
}
<html>
    <head>
    </head>
    <body>
        Content here...
    </body>
</html>
More information here...
like image 21
77Tigers Avatar answered Oct 04 '22 15:10

77Tigers