Prevent Double-Tap Zoom in Web View
Hi!
I try to prevent the double-tap-to-zoom-function of a Web View but without losing all other (custom) events defined in the js of the webpage (like pinch to zoom, 2finger to scroll etc) .
As far as I know a double tap doesn’t generate any events (unlike touch touchstart/move/end). Is there a way to disable doubletapping directly in the js of the webpage loaded into the WebView?
Thank you!
2 Answers
-
Just add the following meta tag in the <head> of your webView html code:
<meta name="viewport" content="user-scalable=0">
This will prevent the user from being able to zoom the page by doubletapping.
-
You can add a listener to dblclick event in your web view. This prevents the default behavior of zoom in a web view
webview.addEventListener('dblclick', function() { Titanium.API.info('dblclick in webview'); });