8three
8three

Reputation: 369

Disable pinch/zoom in Android 2.1 browser on HTC devices

I'm building a mobile site and have the following meta tag set in the header:

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

Unfortunately, this isn't working on HTC devices (HTC Hero, etc) with Android 2.1. Any ideas on how I can disable pinch-to-zoom in this browser? Works fine on the iPhone.

Upvotes: 36

Views: 16408

Answers (4)

BoomShaka
BoomShaka

Reputation: 1791

I've also played with this a LOT, and found no combination that actually disables the zoom. You can however set the initial scale of the page, so when the user access it, it is in the correct zoom level. The default zoom level for android browsers is "medium", but as mentioned, if the user changes this in settings (or pinch zooms), it will not be prevented.

Upvotes: 0

Garrows
Garrows

Reputation: 3031

I have contacted HTC about this issue and they have informed me that they don't have support for the viewport meta tag at all and there is no other way to disable zoom.

Quite disappointing.

Upvotes: 33

Garrows
Garrows

Reputation: 3031

This works on the default android and iPhone browsers. Although sadly it doesn't work for HTC's custom browser (as asked).

<meta content='True' name='HandheldFriendly' />
<meta content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;' name='viewport' />
<meta name="viewport" content="width=device-width" />

Upvotes: 9

Sephy
Sephy

Reputation: 50392

Just an idea, maybe not useful (not tested) :
Did you look into javascript support in Android's WebView? I think you might be able to call WebSettings.setBuiltInZoomControls(false); which might do what you need.

Upvotes: 0

Related Questions