You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Mike M. (JIRA)" <ji...@apache.org> on 2017/05/10 13:42:04 UTC
[jira] [Updated] (CB-12780) Add option to setMixedContentMode on
Android
[ https://issues.apache.org/jira/browse/CB-12780?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mike M. updated CB-12780:
-------------------------
Summary: Add option to setMixedContentMode on Android (was: Add option to setMixedContentMode)
> Add option to setMixedContentMode on Android
> --------------------------------------------
>
> Key: CB-12780
> URL: https://issues.apache.org/jira/browse/CB-12780
> Project: Apache Cordova
> Issue Type: New Feature
> Components: cordova-android
> Affects Versions: 7.0.0
> Reporter: Mike M.
>
> We're currently developing an application that streams audio from a continuous stream over http. We have an existing web application served over https. The audio streams, which are built using HTML5 audio, are served in http only.
> On Android, the WebView won't load our audio stream because of a mixed content error.
> According to my research, this is because on Android, as of API level 20, the WebView gets a mixedContentMode of {{MIXED_CONTENT_NEVER_ALLOW}} by default (see the documentation [here|https://developer.android.com/reference/android/webkit/WebSettings.html#setMixedContentMode(int)]. This is especially frustrating as it doesn't match [what modern browsers do|https://developers.google.com/web/fundamentals/security/prevent-mixed-content/fixing-mixed-content], which is to allow "passive" mixed content that doesn't interact with the page directly like audio/video streams. So in the end, the WebView doesn't behave like the browser, which breaks our application.
> When I change the API target level to 19, the resource gets loaded successfully. However, sticking with API level 19 isn't a long-term solution.
> As seen in [the documentation|https://developer.android.com/reference/android/webkit/WebSettings.html#setMixedContentMode(int)], there is a way to let Android treat mixed content like the browser, which involves setting the MixedContentMode WebSetting to {{MIXED_CONTENT_COMPATIBILITY_MODE}}. However, as I understand it (I'm new to Cordova), this would require me to add custom code to the generated android activity code, which is discouraged and which I would prefer not to do.
> It would be nice if cordova-android added a configuration setting for mixed content which would get translated into setting the MixedContentMode WebSetting. It could look something like:
> {code:xml}
> <platform name="android">
> <preference name="android-mixedContentMode" value="COMPATIBILITY_MODE" />
> </platform>
> {code}
> That would make the code more maintainable and expresses what we need concisely.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org