When using WebView
I can handle errors with onReceivedError
and onReceivedHttpError
. How do I do this with GeckoView
?
Searched through documentation, I expected to find a similar method for GeckoSession
but I can't find any.
When using WebView
I can handle errors with onReceivedError
and onReceivedHttpError
. How do I do this with GeckoView
?
Searched through documentation, I expected to find a similar method for GeckoSession
but I can't find any.
Just set NavigationDelegate to your Gecko Session.
geckoSession.setNavigationDelegate(new GeckoSession.NavigationDelegate() {
@Nullable
@Override
public GeckoResult<String> onLoadError(@NonNull GeckoSession session, @Nullable String uri, @NonNull WebRequestError error) {
return GeckoSession.NavigationDelegate.super.onLoadError(session, uri, error);
}
});
I found it. This can be done by overriding GeckoSession.NavigationDelegate.onLoadError.
See WebResponse for HTTP error codes.