You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have added a restricted set of allowed hostnames, either via addPermittedHostname or via addPermittedHostnames, then that set is evaluated first. So if the hostname of your (next) URL is not in that list, the request is cancelled immediately, before your own handler is called.
Other than that, when you set up a custom WebViewClient, your own handler should be called as you expect.
But, I’m afraid you might have to override the variant of shouldOverrideUrlLoading with String url as its second parameter (yes, although it’s deprecated), not the one with WebResourceRequest request. Can you try that?
(If this works, this aspect should really be fixed or documented. Sorry for that!)
Indeed, overriding shouldOverrideUrlLoading(view: WebView?, url: String?) works.
Would be awesome if you could include this in the docs (or even had a fix 🙂)
First off, thanks so much for this project! 🙏
Saved me lots of time - wish I knew about this before ^^
During implementation of your library, I found a small problem (might as well be on my side)
When registering a
WebViewClient()
like this, I would normally expect theshouldOverrideUrlLoading
function to be called.Expected
wv?.loadUrl()
) theshouldOverrideUrlLoading
function should be calledurl-triggered
should be loggedreturn true
Actual
shouldOverrideUrlLoading
is not called; noting is loggedPossibility to Avoid this / get the expected behaviour
I would not call this a clean approach, but it works 🙄
onPageStarted
wv?.stopLoading()
wv?.onBackPressed()
The text was updated successfully, but these errors were encountered: