Responsive Webdesign: User should not be allowed to zoom
Question by Guest | 2017-12-26 at 13:09
I recently made my website responsive by designing all content scalably and adding the following line to the head of my page:
<meta name="viewport" content="initial-scale=1">
On my smartphone, the website is displayed as expected, but I can still zoom in and out of the page. I have seen other responsive websites where this was somehow prevented.
How can I prevent the visitor from zooming on my page? Do I need JavaScript for that?
Related Topics
AskingBox becomes Responsive
Blog | 0 Comments
Firefox: 15 useful keyboard shortcuts no one knows
Article | 0 Comments
Textarea Maxlength: Limit Maximum Number of Characters in Textarea
Tutorial | 3 Comments
Delphi: GetCursorPos problem on Windows 8.1 with scaling
Open Question | 1 Answer
Windows Batch Script: Computer Shutdown
Tutorial | 2 Comments
JavaScript: Show warning when leaving the page
Info | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
You do not need JavaScript to prevent users from zooming your responsive website. Just add "user-scalable=no" to your viewport line above:
This prevents zooming.
But think carefully about whether this setting really makes sense and how it changes the user experience. There are many webpages where I would like to zoom in on a picture or zoom out of a large table, for example, which will all be prevented by this property.
2017-12-26 at 21:28