Search code examples
webviewnativescript

NativeScript: How do I disable zoom controls in WebView?


I found the way to enable/disable zoom controls in Android WebView from following question.

How to remove zoom buttons on Android webview?

I'm using NativeScript and I don't see similar method in NativeScript WebView. Is there any way I can access the methods of Android WebView from NativeScript? Or, is there any other way?

Thanks.


Solution

  • You can get hold of the actual android trough the android property of your WebView. So you can probably use something like that in the loaded event:

    var webView = page.getViewById("webViewID");
    if(webView.android) { // in IOS android will be undefined
      webView.android.getSettings().setBuiltInZoomControls(false);
    }