Reputation: 14593
I've build an Android app using CapacitorJS and I want to disable the native webview's swipe navigation (swipe from edges to go forward/back). Is that possible?
Can this be done through Javascript or an HTML meta tag? As far as I can tell this is not possible.
Is there a Capacitor plugin or setting to do this? (Ionic, which uses Capacitor, has the swipeBackEnabled
setting that sounds like it does what I'm looking for)
If not, can it be set on the Android WebView directly?
Upvotes: 2
Views: 399
Reputation: 5638
Disabling swipe navigation in Android's WebView when using CapacitorJS cannot be achieved directly through JavaScript or HTML metatag, because this behavior is tied to the native WebView's default settings.
But you can achieve SOMETHING LIKE THAT by customizing native Android codes:
OnCreate()
method:protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
WebView webView = this.bridge.getWebView();
webView.setOverScrollMode(WebView.OVER_SCROLL_NEVER); // This disables edge-swipe navigation.
}
Upvotes: 0