Xamarin.forms: [Enhancement] Android PlatformSpecific for WebView mixed content

Created on 26 Jan 2018  Â·  4Comments  Â·  Source: xamarin/Xamarin.Forms

Rationale

There is currently no way to modify an Android WebView's mixed content mode setting without creating a custom renderer.

Implementation.

Add a PlatformSpecific property for WebView on Android to set the value of WebSettings.MixedContentMode.

enum MixedContentHandling
{
    AlwaysAllow = 0,
    NeverAllow = 1,
    CompatibilityMode = 2
}

public static readonly BindableProperty MixedContentModeProperty = BindableProperty.Create("MixedContentMode", typeof(MixedContentHandling), typeof(WebView), MixedContentHandling.NeverAllow);

Below API 21 this value should be ignored. At API 21 or above, this value should be applied to MixedContentMode.

There is currently no applicable setting for iOS (allowing mixed content requires modifying application-level plist values) or UWP (the UWP WebView just lets any old thing load up).

Backward Compatibility

At API 21 and above, this value defaults to NeverAllow; below API 21, it is ignored. So as long as the default value of the PlatformSpecific is NeverAllow, this should be backward compatible.

Difficulty: Easy

F100 community-sprint Android enhancement âž•

Most helpful comment

@hartez @davidortinau @adamped i have a PR for this ready here: https://github.com/XamarinFormsCommunity/Xamarin.Forms/pull/3. Thanks!

All 4 comments

I can take this!

@davidortinau I've claimed this a few days ago but it hasn't been moved to in progress, just an FYI

@alanag13 Have at it.

@hartez @davidortinau @adamped i have a PR for this ready here: https://github.com/XamarinFormsCommunity/Xamarin.Forms/pull/3. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattregul picture mattregul  Â·  3Comments

EmilAlipiev picture EmilAlipiev  Â·  3Comments

joseluisct picture joseluisct  Â·  3Comments

deakjahn picture deakjahn  Â·  3Comments

jgold6 picture jgold6  Â·  3Comments