cordovacapacitorcordova-android

Overriding shouldOverrideUrlLoading and onPageFinished on the CapacitorWebView


I need to override shouldOverrideUrlLoading and onPageFinished on the CapacitorWebView in my app. One way I got working was to get the WebView client via getBridge().getWebView().getWebViewClient(), set a new WebView client and proxy every call to the overrided methods to the original WebView client. This works, but not on Android 7 and below where there are no getWebViewClient() method.

Is there a better way to hook into the shouldOverrideUrlLoading and onPageFinished methods on the Cordova WebView? How should I do this?

Thank you
Søren


Solution

  • It's not possible at the moment.

    I've created an issue so it can be implemented https://github.com/ionic-team/capacitor/issues/2230