settings.setMixedContentMode(webViewMixedContentMode);
@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); } }
mWebSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); webView.setLayerType(View.LAYER_TYPE_HARDWARE, null); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
private void initialize() { loadUrl("file:///android_asset/html/preview.html"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getSettings().setAllowUniversalAccessFromFileURLs(true); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } setWebChromeClient(new WebChromeClient() { @SuppressLint("JavascriptInterface") @Override public void onProgressChanged(WebView view, int newProgress) { super.onProgressChanged(view, newProgress); if (newProgress == 100) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { loadUrl(mPreviewText); } else { evaluateJavascript(mPreviewText, null); } } } }); }
@SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"}) private void init() { APP_CACHE_DIRNAME = getContext().getFilesDir().getAbsolutePath() + "/webcache"; WebSettings settings = getSettings(); settings.setDomStorageEnabled(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().setAcceptThirdPartyCookies(this, true); settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } settings.setAllowFileAccess(false); settings.setAppCacheEnabled(false); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); settings.setJavaScriptEnabled(true); settings.setLoadWithOverviewMode(true); settings.setAppCachePath(APP_CACHE_DIRNAME); settings.setUseWideViewPort(true); super.setWebChromeClient(mWebChromeClient); addInternalJavascriptObject(); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) { super.addJavascriptInterface(innerJavascriptInterface, BRIDGE_NAME); } else { // add dsbridge tag in lower android version settings.setUserAgentString(settings.getUserAgentString() + " _dsbridge"); } }
private void setMixedContent(WebSettings settings) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // 允许http https 混合图片加载 settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } }
@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); } }
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public void setMixLoad(){ mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); }
public WikiView(Context context, AttributeSet attrs) { super(context, attrs); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !isInEditMode()) { //this allows the webview to inject the css (otherwise it blocks it for security reasons) getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } }
private void initWebView() { webview.getSettings().setJavaScriptEnabled(true); //设置当一个安全站点企图加载来自一个不安全站点资源时WebView的行为 https与http if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { webview.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } webview.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH); webview.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); //设置 缓存模式 // webview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ONLY); // 开启 DOM storage API 功能 webview.getSettings().setDomStorageEnabled(true); //开启 database storage API 功能 webview.getSettings().setDatabaseEnabled(true); String cacheDirPath = Environment.getExternalStorageDirectory() + "/Madreain"; //设置数据库缓存路径 webview.getSettings().setDatabasePath(cacheDirPath); //设置 Application Caches 缓存目录 webview.getSettings().setAppCachePath(cacheDirPath); //开启 Application Caches 功能 webview.getSettings().setAppCacheEnabled(true); webview.getSettings().setUserAgentString(webview.getSettings().getUserAgentString() + Constants.MADREAIN_UA_EXTRA); }
private void initWebView() { webview.getSettings().setJavaScriptEnabled(true); //设置当一个安全站点企图加载来自一个不安全站点资源时WebView的行为 https与http if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { webview.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } webview.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH); webview.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); //设置 缓存模式 // webview.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ONLY); // 开启 DOM storage API 功能 webview.getSettings().setDomStorageEnabled(true); //开启 database storage API 功能 webview.getSettings().setDatabaseEnabled(true); String cacheDirPath = Environment.getExternalStorageDirectory() + "/Madreain"; //设置数据库缓存路径 webview.getSettings().setDatabasePath(cacheDirPath); //设置 Application Caches 缓存目录 webview.getSettings().setAppCachePath(cacheDirPath); //开启 Application Caches 功能 webview.getSettings().setAppCacheEnabled(true); webview.getSettings().setUserAgentString(webview.getSettings().getUserAgentString() + Constants.MADREAIN_UA_EXTRA); }
final WebSettings settings = wv_payment.getSettings(); settings.setJavaScriptEnabled(true); settings.setDisplayZoomControls(false); settings.setAppCacheEnabled(true); settings.setLoadsImagesAutomatically(true); settings.setBuiltInZoomControls(false); settings.setPluginState(WebSettings.PluginState.ON); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
final WebSettings settings = easyweb.getSettings(); settings.setJavaScriptEnabled(true); settings.setDisplayZoomControls(false); settings.setAppCacheEnabled(true); settings.setLoadsImagesAutomatically(true); settings.setBuiltInZoomControls(false); settings.setPluginState(WebSettings.PluginState.ON); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); easyweb.loadUrl("http://www.doriddles.com/Riddles/Easy");
getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
private void init(Context context) { if (!isInEditMode()) { setWebViewClient(new MyWebViewClient((Activity) context)); // Create our ScaleGestureDetector mScaleDetector = new ScaleGestureDetector(context, new ScaleListener()); // fake user agent to mobile String userAgent = this.getSettings().getUserAgentString(); if (!userAgent.contains("Mobile")) { if (userAgent.contains("Safari")) { userAgent = userAgent.replace("Safari", "Mobile Safari"); } else { userAgent = userAgent + " Mobile Safari/537.16"; } this.getSettings().setUserAgentString(userAgent); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // allow to open local file even in https mode. this.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } } }
public void initWeb() { // web.clearCache(true); // web.clearHistory(); web.requestFocus(); WebSettings webSettings = web.getSettings(); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); webSettings.setJavaScriptEnabled(true); webSettings.setSupportZoom(true); webSettings.setBuiltInZoomControls(true); webSettings.setBlockNetworkImage(false); webSettings.setDomStorageEnabled(true); webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); webSettings.setDomStorageEnabled(true); webSettings.setAllowFileAccess(true); webSettings.setAppCacheEnabled(true); webSettings.setUseWideViewPort(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } }
@SuppressLint("SetJavaScriptEnabled") private void initWebViewSetting() { mWebView.setVerticalScrollBarEnabled(false); mWebView.setHorizontalScrollBarEnabled(false); WebSettings webSetting = mWebView.getSettings(); webSetting.setJavaScriptEnabled(true); webSetting.setAllowFileAccess(true); webSetting.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS); webSetting.setSupportZoom(false); webSetting.setBuiltInZoomControls(false); webSetting.setUseWideViewPort(true); webSetting.setSupportMultipleWindows(false); webSetting.setLoadWithOverviewMode(true); webSetting.setAppCacheEnabled(true); webSetting.setDatabaseEnabled(true); webSetting.setGeolocationEnabled(true); webSetting.setDomStorageEnabled(true); webSetting.setAppCacheMaxSize(Long.MAX_VALUE); webSetting.setAppCachePath(getDir("appCache", Context.MODE_PRIVATE).getPath()); webSetting.setDatabasePath(getDir("databases", Context.MODE_PRIVATE).getPath()); webSetting.setGeolocationDatabasePath(getDir("geolocation", Context.MODE_PRIVATE).getPath()); webSetting.setPluginState(WebSettings.PluginState.ON); webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH); webSetting.setTextSize(WebSettings.TextSize.NORMAL); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { webSetting.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } mWebView.loadUrl(mUrl); }
ws.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
private void setWebSeting() { WebSettings settings = webView.getSettings(); settings.setDefaultTextEncodingName("UTF-8"); settings.setSupportZoom(false); settings.setDisplayZoomControls(false); settings.setJavaScriptEnabled(true); settings.setBlockNetworkImage(true); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); settings.setAppCacheEnabled(false); settings.setSaveFormData(false); // 自适应屏幕 settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } webView.setWebViewClient(new MyWebViewClient()); }
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);