List of usage examples for android.webkit WebView clearFormData
public void clearFormData()
From source file:de.baumann.browser.helper.helper_webView.java
public static void closeWebView(Activity from, WebView webView) { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(from); if (sharedPref.getBoolean("clearCookies", false)) { CookieManager cookieManager = CookieManager.getInstance(); cookieManager.removeAllCookies(null); cookieManager.flush();/*from w ww . ja va2 s .co m*/ } if (sharedPref.getBoolean("clearCache", false)) { webView.clearCache(true); } if (sharedPref.getBoolean("clearForm", false)) { webView.clearFormData(); } if (sharedPref.getBoolean("history", false)) { from.deleteDatabase("history.db"); webView.clearHistory(); } helper_main.isClosed(from); sharedPref.edit().putString("started", "").apply(); from.finishAffinity(); }
From source file:com.just.agentweb.AgentWebUtils.java
static void clearWebViewAllCache(Context context, WebView webView) { try {// w w w. j a v a 2s.c o m AgentWebConfig.removeAllCookies(null); webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); context.deleteDatabase("webviewCache.db"); context.deleteDatabase("webview.db"); webView.clearCache(true); webView.clearHistory(); webView.clearFormData(); clearCacheFolder(new File(AgentWebConfig.getCachePath(context)), 0); } catch (Exception ignore) { //ignore.printStackTrace(); if (AgentWebConfig.DEBUG) { ignore.printStackTrace(); } } }
From source file:org.openqa.selendroid.server.model.SelendroidWebDriver.java
private void configureWebView(final WebView view) { ServerInstrumentation.getInstance().runOnUiThread(new Runnable() { @Override/* www . j av a 2s . c o m*/ public void run() { view.clearCache(true); view.clearFormData(); view.clearHistory(); view.setFocusable(true); view.setFocusableInTouchMode(true); view.setNetworkAvailable(true); view.setWebChromeClient(new MyWebChromeClient()); WebSettings settings = view.getSettings(); settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setSupportMultipleWindows(true); settings.setBuiltInZoomControls(true); settings.setJavaScriptEnabled(true); settings.setAppCacheEnabled(true); settings.setAppCacheMaxSize(10 * 1024 * 1024); settings.setAppCachePath(""); settings.setDatabaseEnabled(true); settings.setDomStorageEnabled(true); settings.setGeolocationEnabled(true); settings.setSaveFormData(false); settings.setSavePassword(false); settings.setRenderPriority(WebSettings.RenderPriority.HIGH); // Flash settings settings.setPluginState(WebSettings.PluginState.ON); // Geo location settings settings.setGeolocationEnabled(true); settings.setGeolocationDatabasePath("/data/data/selendroid"); } }); }
From source file:io.selendroid.server.model.SelendroidWebDriver.java
private void configureWebView(final WebView view) { ServerInstrumentation.getInstance().getCurrentActivity().runOnUiThread(new Runnable() { @Override/*from w w w . j a va2 s . c o m*/ public void run() { try { view.clearCache(true); view.clearFormData(); view.clearHistory(); view.setFocusable(true); view.setFocusableInTouchMode(true); view.setNetworkAvailable(true); // need to check the class name rather than checking instanceof // since when it is not an instanceof, it likely means the app under test // does not contain the Cordova project and this will cause a RuntimeException if (view.getClass().getSimpleName().equalsIgnoreCase("CordovaWebView")) { CordovaWebView webview = (CordovaWebView) view; CordovaInterface ci = null; chromeClient = new ExtendedCordovaChromeClient(null, webview); } else { chromeClient = new SelendroidWebChromeClient(); } view.setWebChromeClient(chromeClient); WebSettings settings = view.getSettings(); settings.setJavaScriptCanOpenWindowsAutomatically(true); settings.setSupportMultipleWindows(true); settings.setBuiltInZoomControls(true); settings.setJavaScriptEnabled(true); settings.setAppCacheEnabled(true); settings.setAppCacheMaxSize(10 * 1024 * 1024); settings.setAppCachePath(""); settings.setDatabaseEnabled(true); settings.setDomStorageEnabled(true); settings.setGeolocationEnabled(true); settings.setSaveFormData(false); settings.setSavePassword(false); settings.setRenderPriority(WebSettings.RenderPriority.HIGH); // Flash settings settings.setPluginState(WebSettings.PluginState.ON); // Geo location settings settings.setGeolocationEnabled(true); settings.setGeolocationDatabasePath("/data/data/selendroid"); } catch (Exception e) { SelendroidLogger.error("Error configuring web view", e); } } }); }
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. *//*ww w .j a v a 2 s . c o m*/ 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()); }
From source file:org.golang.app.WViewActivity.java
private void initWebView(WebView webView) { WebSettings settings = webView.getSettings(); settings.setJavaScriptEnabled(true); settings.setAllowFileAccess(true);/*from w w w . j av a 2 s .c o m*/ settings.setDomStorageEnabled(true); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); settings.setLoadWithOverviewMode(true); settings.setUseWideViewPort(true); settings.setSupportZoom(true); // settings.setPluginsEnabled(true); methodInvoke(settings, "setPluginsEnabled", new Class[] { boolean.class }, new Object[] { true }); // settings.setPluginState(PluginState.ON); methodInvoke(settings, "setPluginState", new Class[] { PluginState.class }, new Object[] { PluginState.ON }); // settings.setPluginsEnabled(true); methodInvoke(settings, "setPluginsEnabled", new Class[] { boolean.class }, new Object[] { true }); // settings.setAllowUniversalAccessFromFileURLs(true); methodInvoke(settings, "setAllowUniversalAccessFromFileURLs", new Class[] { boolean.class }, new Object[] { true }); // settings.setAllowFileAccessFromFileURLs(true); methodInvoke(settings, "setAllowFileAccessFromFileURLs", new Class[] { boolean.class }, new Object[] { true }); webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); webView.clearHistory(); webView.clearFormData(); webView.clearCache(true); webView.setWebChromeClient(new MyWebChromeClient()); // webView.setDownloadListener(downloadListener); }