Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Android] WebView Navigating event not always fired #3778

Closed
jcmanke opened this issue Sep 13, 2018 · 1 comment
Closed

[Android] WebView Navigating event not always fired #3778

jcmanke opened this issue Sep 13, 2018 · 1 comment
Labels
blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. e/2 🕑 2 p/Android t/bug 🐛
Milestone

Comments

@jcmanke
Copy link
Contributor

jcmanke commented Sep 13, 2018

Description

In the Android WebViewRenderer, the Navigating event is fired from the ShouldOverrideUrlLoading(AWebView view, string url) method in the WebClient, which seems to get hit when the original URL is redirected or navigation occurs from the initial URL, but not when the original URL begins loading. (This method was also deprecated in API level 24 and replaced with ShouldOverrideUrlLoading(AWebView webView, WebResourceRequest request) .)

The WebClient should instead override the OnPageStarted method and fire the Navigating event there, for consistency with firing the Navigated event from OnPageFinished. This method is hit for initial loads, redirects, and subsequent navigations.

I also believe that WebClient should be moved from a private inner class of the WebViewRenderer to a public class, so that custom renderers can subclass it to inject custom WebViewClients without having to re-implement firing of all the WebView events.

https://forums.xamarin.com/discussion/138821/navigating-on-android-webview-doesnt-always-fire

Steps to Reproduce

  1. Add a WebView to a page in a Xamarin.Forms project
  2. Register for the Navigating event of the WebView
  3. Set the source to a UrlWebViewSource that will not redirect (e.g. https://www.google.com)
  4. Run on an Android device

WebViewAndroid.zip

Expected Behavior

The Navigating event will be fired when the WebView begins loading google.com.

Actual Behavior

The Navigating event is not fired.

Basic Information

  • Affected Devices: Android
@PureWeen PureWeen added this to the 3.3.0 milestone Sep 13, 2018
@samhouts samhouts added blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. and removed blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. labels Sep 21, 2018
@samhouts
Copy link
Member

samhouts commented Oct 5, 2018

closed by #3780

@samhouts samhouts closed this as completed Oct 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. e/2 🕑 2 p/Android t/bug 🐛
Projects
None yet
Development

No branches or pull requests

3 participants