Example usage for android.webkit WebSettings MIXED_CONTENT_COMPATIBILITY_MODE

List of usage examples for android.webkit WebSettings MIXED_CONTENT_COMPATIBILITY_MODE

Introduction

In this page you can find the example usage for android.webkit WebSettings MIXED_CONTENT_COMPATIBILITY_MODE.

Prototype

int MIXED_CONTENT_COMPATIBILITY_MODE

To view the source code for android.webkit WebSettings MIXED_CONTENT_COMPATIBILITY_MODE.

Click Source Link

Document

Used with #setMixedContentMode In this mode, the WebView will attempt to be compatible with the approach of a modern web browser with regard to mixed content.

Usage

From source file:com.facebook.react.views.webview.ReactWebViewManager.java

@ReactProp(name = "mixedContentMode")
public void setMixedContentMode(WebView view, @Nullable String mixedContentMode) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (mixedContentMode == null || "never".equals(mixedContentMode)) {
            view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_NEVER_ALLOW);
        } else if ("always".equals(mixedContentMode)) {
            view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
        } else if ("compatibility".equals(mixedContentMode)) {
            view.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
        }/*from  w ww.  j  a v a  2  s  .  c o  m*/
    }
}