Example usage for android.webkit WebSettings MIXED_CONTENT_NEVER_ALLOW

List of usage examples for android.webkit WebSettings MIXED_CONTENT_NEVER_ALLOW

Introduction

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

Prototype

int MIXED_CONTENT_NEVER_ALLOW

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

Click Source Link

Document

Used with #setMixedContentMode In this mode, the WebView will not allow a secure origin to load content from an insecure origin.

Usage

From source file:com.creativtrendz.folio.ui.FolioWebViewScroll.java

@SuppressWarnings("static-method")
@SuppressLint("NewApi")
protected void setMixedContentAllowed(final WebSettings webSettings, final boolean allowed) {
    if (Build.VERSION.SDK_INT >= 21) {
        webSettings.setMixedContentMode(
                allowed ? WebSettings.MIXED_CONTENT_ALWAYS_ALLOW : WebSettings.MIXED_CONTENT_NEVER_ALLOW);
    }/*from   w ww  . ja  v a2  s.c  o m*/
}

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 av  a2  s.  c o m*/
    }
}