Skip to content

[iOS|Android] WebView events delegation #1298

Open
@sandervandenbrink

Description

@sandervandenbrink

In Android the Bridge class and in iOS the Bridge View Controller don't delegate the WebView events.
I'm using Capacitor to fetch the web app remotely and if loading of the client fails (e.g. timeout or host not found) then there is no way to handle this with for example a screen that informs the user.

Perhaps an idea would be to have a listener/delegate property available in the Android Bridge class and the iOS CAPBridgeViewController that can optionally be set before the webview is being loaded.

Additionally I noticed that the WKWebView reload won't work if the initial load of the web client failed (because the url will be nil) so it would be convenient if the CAPBridgeViewController has a public load/reload method that uses the url from the config.

I don't have any other use cases than the error methods webView(_:didFailProvisionalNavigation:withError:) and onReceivedError (Note that this one is deprecated since API 23), so I'm not sure whether it's necessary to delegate more or all the webview events.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions