Setting the zoom level in a mobile browser

I am creating a site for mobile access, and I want to set the width, height and size of the buttons so that they display the fill of the screen. For example, if a user uses HTC HD, the entire screen will be 480x800 with a button size of 240x200. However, IE mobile and Opera load the page at some level of zoom, so the buttons appear too large or too small. How can I either read the current zoom level in javascript or install it from javascript?

+5
source share
2 answers

Take a look at <meta name="viewport">. It supported a wide variety of mobile platforms, including (AFAIK) iPhone, Android, Blackberry, Opera Mobile, and even IE6 Mobile. In fact, it allows you to pre-set the width of the device, the zoom level and the maximum / minimum increase. Take a look at the Apple Developer site and learn more.

In addition, you can use CSS media queries to determine the shape and size of the browser and handle various layouts (etc.) accordingly. Again, they are pretty widely supported, and there is more information on the Apple Developer site .

+5
source

JavaScript , - . , , 100%, . body {width: 100%; margin: 0; padding: 0;}

, .

0

All Articles