Quantcast
Channel: User Liyun Zhang - MSFT - Stack Overflow
Viewing all articles
Browse latest Browse all 445

Answer by Liyun Zhang - MSFT for WebView Handler not loading on Android

$
0
0

I can reproduce your problem on the Android. This because you didn't set the source property for the webview. So the MapSource method of the WebViewHandler wasn't called. The Android webview's url is blank when I debugged to check after the page rendered.

The easiest way to fix it is setting the webview's source. Such as:

<local:AuthenticatedWebView Source=""/>

In addition, you don't have to declare the url in the mapping method. You can still using the webview's source property and get it in the mapping method. Such as:

 Microsoft.Maui.Handlers.WebViewHandler.Mapper.AppendToMapping(nameof(IWebView.Source), async (handler, view) =>        {            if (view is AuthenticatedWebView webView)            {                var url = view.Source.ToString();                var token = "";                ......        });    }

Viewing all articles
Browse latest Browse all 445

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>