Skip to content

Instantly share code, notes, and snippets.

@HeikkiDev
Created April 22, 2021 07:08
Show Gist options
  • Select an option

  • Save HeikkiDev/0aa8008b3c64e84fc58c392bba01b499 to your computer and use it in GitHub Desktop.

Select an option

Save HeikkiDev/0aa8008b3c64e84fc58c392bba01b499 to your computer and use it in GitHub Desktop.
[assembly: ExportRenderer(typeof(YourCustomWebView), typeof(yourcompany.Droid.Renderers.ChromeClientWebViewRenderer))]
namespace yourcompany.Droid.Renderers
{
internal class ChromeClientWebViewRenderer : WebViewRenderer
{
public AdvancedWebViewRenderer(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.WebView> e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
{
Control.SetWebChromeClient(new CustomWebChromeClient(_context as Activity));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment