views:

381

answers:

5

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.

A: 

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.

Sephy
I'm not developing an android app though - I'm developing a mobile website meant to be viewed in a browser. Thanks though.
8three
yeah but still, you know how to write javascript? The javascript will be loaded by android's webviews and browser, so it should be executed. I gave you the method to call from the javascript which might be able to prevent zooming.
Sephy
Yeah, I understand. Thanks again for the suggestion, but unfortunately, it doesn't work. Still looking for a solution to this. It seems to only happen on HTC devices.
8three
I need this figured out as well.
Bry4n
+1  A: 

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" />
Garrows
A: 

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.

Garrows
A: 

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.

BoomShaka
A: 

I have also been annoyed by this for ages, BUT I have just tried the SkyFire (beta) browser, and it seems to behave. i.e. it doesn't auto zoom when I double click (click fast) on a web page that sets the viewport meta tag. Can someone else try this and confirm it?

alc