views:

676

answers:

2

Is there any way to completely disable web page scrolling in an iPhone web app? I've tried numerous things posted on google, but none seem to work.

Here's my current header setup:

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>

document.body.addEventListener('touchmove', function(e){ e.preventDefault(); });

doesn't seem to work.

+3  A: 

Change to the touchstart event instead of touchmove. Under One Finger Events it says that no events are sent during a pan, so touchmove may be too late.

I added the listener to document, not body.

drawnonward
You actually need to use both touchstart AND touchmove, or you can still get scrolling.
Stefan Kendall
This work very well, thank you.
Jirapong
A: 

The page has to be launched from the Home screen for the meta tag to work.

Freebie