"User Interaction Enable" on a webview (or disable scrolling)
Hi,
is there a way to prevent user interaction on a webview like in Xcode/Interface Builder (Checkbox User Interaction Enabled)?
I want to disable scrolling on my webview.
Thanks!
9 Answers
-
Accepted Answer
You should be able to disable scrolling like this:
var webView = Ti.UI.createWebView({ ... }); ... webView.addEventListener("touchmove", function(e) { e.preventDefault(); });
-
Right answer is, put the following in your HTML:
<script type="text/javascript"> document.addEventListener("touchmove", function(e){ e.preventDefault(); return false; }, false); </script>
-
To disable the scroll on the webview, simply write an empty touchstart function, like this:
myWebView.addEventListener('touchstart',function(){ });
It will simply override the default touchstart. :)
-
Thank you. The eventlistener does work (added an alert) but i can still scroll. What am i doing wrong?
EDIT:
Got it working:
I added the e.preventDefault() in touchStart, touchMove & touchEnd directly in the html.
Thank yout! -
Hey guys, I had the same problem and
e.preventDefault();
worked just fine. Except that myclick
events aren't working anymore. Looks likee.preventDefault()
is preventing everyevent
from being fired or working as default.How to prevent the
scroll
event but still enable theclick
event? -
Still looking for the holy grail :)
I have a webview in a scrollview, the scrollview should scroll, but the web view shouldn't bounce… solutions? -
HI,
I am experiencing the same problem and have search everywhere for an answer without success!
Has anyone managed to find a solution to this problem and if so please can you post it on this forum.
Many Thanks!
-
Still waiting, would be nice to get this fixed.
-
bump