Merge pull request #101 from DreamBuddy/master
add new option to control the contentMode in Android platform
This commit is contained in:
commit
c51497b0b0
|
@ -191,6 +191,16 @@ public class InAppWebView extends WebView {
|
||||||
if (options.transparentBackground) {
|
if (options.transparentBackground) {
|
||||||
setBackgroundColor(Color.TRANSPARENT);
|
setBackgroundColor(Color.TRANSPARENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!options.mixedContentMode.isEmpty()) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
if (options.mixedContentMode.equals("MIXED_CONTENT_COMPATIBILITY_MODE")) {
|
||||||
|
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
|
||||||
|
} else if (options.mixedContentMode.equals("MIXED_CONTENT_ALWAYS_ALLOW")) {
|
||||||
|
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadUrl(String url, MethodChannel.Result result) {
|
public void loadUrl(String url, MethodChannel.Result result) {
|
||||||
|
@ -355,6 +365,16 @@ public class InAppWebView extends WebView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newOptionsMap.get("mixedContentMode") != null && options.mixedContentMode != newOptions.mixedContentMode) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
if (newOptions.mixedContentMode.equals("MIXED_CONTENT_COMPATIBILITY_MODE")) {
|
||||||
|
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
|
||||||
|
} else if (newOptions.mixedContentMode.equals("MIXED_CONTENT_ALWAYS_ALLOW")) {
|
||||||
|
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
options = newOptions;
|
options = newOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,4 +24,5 @@ public class InAppWebViewOptions extends Options {
|
||||||
public boolean useWideViewPort = true;
|
public boolean useWideViewPort = true;
|
||||||
public boolean safeBrowsingEnabled = true;
|
public boolean safeBrowsingEnabled = true;
|
||||||
public boolean transparentBackground = false;
|
public boolean transparentBackground = false;
|
||||||
|
public String mixedContentMode = "MIXED_CONTENT_NEVER_ALLOW";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue