Example usage for android.webkit WebSettings setAllowContentAccess

List of usage examples for android.webkit WebSettings setAllowContentAccess

Introduction

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

Prototype

public abstract void setAllowContentAccess(boolean allow);

Source Link

Document

Enables or disables content URL access within WebView.

Usage

From source file:com.air.mobilebrowser.BrowserActivity.java

/** 
 * Configure a webview to use the activity as
 * its client, and update its settings with 
 * the desired parameters for the activity.
 * @param webView the webview to configure.
 *///w  w w.j ava2 s  . c  om
private void configureWebView(WebView webView) {
    webView.clearCache(true);
    webView.setWebViewClient(new SecureWebClient(this));

    WebSettings settings = mWebView.getSettings();
    settings.setBuiltInZoomControls(true);
    settings.setJavaScriptEnabled(true);
    //      settings.setPluginState(PluginState.ON_DEMAND);
    settings.setPluginState(PluginState.ON);
    settings.setAllowFileAccess(true);
    settings.setAllowContentAccess(true);
    settings.setSaveFormData(false);
    settings.setSavePassword(false);
    webView.clearFormData();
    settings.setDomStorageEnabled(true);
    String defaultUserAgent = settings.getUserAgentString();

    StringBuilder sb = new StringBuilder();
    sb.append(defaultUserAgent);
    sb.append(" SmarterSecureBrowser/1.0");
    sb.append(" OS/");
    sb.append(mDeviceStatus.operatingSystem);
    sb.append(" Version/");
    sb.append(mDeviceStatus.operatingSystemVersion);
    sb.append(" Model/");
    sb.append(mDeviceStatus.model);

    settings.setUserAgentString(sb.toString());
}