@Override public void clearHistory() { if (mIsInited) { super.clearHistory(); } }
WebView vistaWeb = (WebView) findViewById(R.id.webview); vistaWeb.setWebChromeClient(new MyCustomChromeClient(this)); vistaWeb.setWebViewClient(new MyCustomWebViewClient(this)); vistaWeb.clearCache(true); vistaWeb.clearHistory(); vistaWeb.getSettings().setJavaScriptEnabled(true); vistaWeb.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
@Override public void onPageFinished(android.webkit.WebView view, String url) { super.onPageFinished(view, url); WebView webView = (WebView) view; if (TextUtils.equals(url, BLANK)) { // has pending reload, open corresponding URL if (!TextUtils.isEmpty(webView.mPendingHtml)) { view.loadDataWithBaseURL(webView.mPendingUrl, webView.mPendingHtml, "text/html", "UTF-8", webView.mPendingUrl); } else { view.loadUrl(webView.mPendingUrl); } } else if (!TextUtils.isEmpty(webView.mPendingUrl) && TextUtils.equals(url, webView.mPendingUrl)) { // reload done, clear history webView.mPendingUrl = null; webView.mPendingHtml = null; view.clearHistory(); } if (mClient != null) { mClient.onPageFinished(view, url); } }
static final void clearWebView(WebView m) { if (m == null) { return; } if (Looper.myLooper() != Looper.getMainLooper()) { return; } m.loadUrl("about:blank"); m.stopLoading(); if (m.getHandler() != null) { m.getHandler().removeCallbacksAndMessages(null); } m.removeAllViews(); ViewGroup mViewGroup = null; if ((mViewGroup = ((ViewGroup) m.getParent())) != null) { mViewGroup.removeView(m); } m.setWebChromeClient(null); m.setWebViewClient(null); m.setTag(null); m.clearHistory(); m.destroy(); m = null; }
static void clearWebViewAllCache(Context context, WebView webView) { try { 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(); } } }
@Test public void getUrl() throws Exception { webView.clearHistory(); assertThat(webView.getUrl()).isNull(); webView.loadUrl("fake.url", null); assertThat(webView.getUrl()).isEqualTo("fake.url"); }
myWebView.clearHistory(); android.webkit.CookieManager cookieManager = CookieManager.getInstance(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
@Test public void getOriginalUrl() throws Exception { webView.clearHistory(); assertThat(webView.getOriginalUrl()).isNull(); webView.loadUrl("fake.url", null); assertThat(webView.getOriginalUrl()).isEqualTo("fake.url"); }
@Test public void canGoBack() throws Exception { webView.clearHistory(); assertThat(webView.canGoBack()).isFalse(); webView.loadUrl("fake.url", null); webView.loadUrl("fake.url", null); assertThat(webView.canGoBack()).isTrue(); webView.goBack(); assertThat(webView.canGoBack()).isFalse(); }
@Test public void shouldRecordClearHistory() { assertThat(shadowOf(webView).wasClearHistoryCalled()).isFalse(); webView.clearHistory(); assertThat(shadowOf(webView).wasClearHistoryCalled()).isTrue(); }
@Override public void onDestroyView() { super.onDestroyView(); if (mWebView != null) { Log.d("DAboutActivity", "onDestroy"); mWebView.removeAllViews(); mWebView.setWebViewClient(null); ((ViewGroup) mWebView.getParent()).removeView(mWebView); mWebView.setTag(null); mWebView.clearHistory(); mWebView.destroy(); mWebView = null; } } }
/** * Clear the history and all the back and forward stacks */ @Override public void clearHistory() { super.clearHistory(); backStack.clear(); forwardStack.clear(); }
WebView webView = (WebView) findViewById(R.id.webview); webView = (WebView) findViewById(R.id.webview); webView.clearCache(true); webView.clearHistory(); /* Enabling javascript */ webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
WebView myWebView = (WebView) findViewById(R.id.webview); myWebView.setWebChromeClient(new InredisChromeClient(this)); myWebView.setWebViewClient(new InredisWebViewClient(this)); myWebView.clearCache(true); myWebView.clearHistory(); myWebView.getSettings().setJavaScriptEnabled(true); myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); myWebView.loadUrl("http://demo.com/content.html?font-size=12&fontcolor=blue");
WebView view = (WebView) findViewById(R.id.webview1); view = (WebView) findViewById(R.id.webview); view .setWebChromeClient(new InredisChromeClient(this)); view .setWebViewClient(new InredisWebViewClient(this)); view .clearCache(true); view .clearHistory(); view .getSettings().setJavaScriptEnabled(true); view .getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
WebView webView=(WebView)v.findViewById(R.id.webView1); FGWebViewClient webViewClient= new FGWebViewClient(context); webView.setWebViewClient(webViewClient); webView.setWebChromeClient(new WebChromeClient()); webView.clearCache(true); webView.clearHistory(); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); webView.loadUrl((webUrl).toString());
WebView browser; browser.clearFormData(); browser.clearHistory(); browser.clearCache(true); browser.getSettings().setAppCacheEnabled(true); browser.getSettings().setDatabaseEnabled(true); browser.getSettings().setDomStorageEnabled(true); browser.setWebChromeClient(new WebChromeClient());
@Override protected void onDestroy() { if (mWebview != null) { mWebview.loadDataWithBaseURL(null, "", "text/html", "utf-8", null); mWebview.clearHistory(); ((ViewGroup) mWebview.getParent()).removeView(mWebview); mWebview.destroy(); mWebview = null; } super.onDestroy(); } }
@Override protected void onDestroy() { if (webView!= null) { webView.loadDataWithBaseURL(null, "", "text/html", "utf-8", null); webView.clearHistory(); ((ViewGroup) webView.getParent()).removeView(webView); webView.destroy(); webView= null; } super.onDestroy(); } }
public void clear() { if (mWebView != null) { mRootView.removeView(mWebView); mWebView.clearHistory(); mWebView.clearCache(true); mWebView.destroy(); mWebView = null; } }