android.webkit.WebView.clearHistory()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中android.webkit.WebView.clearHistory()方法的一些代码示例,展示了WebView.clearHistory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.clearHistory()方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:clearHistory

WebView.clearHistory介绍

暂无

代码示例

代码示例来源:origin: Justson/AgentWeb

@Override
public void clearHistory() {
  if (mIsInited) {
    super.clearHistory();
  }
}

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: hidroh/materialistic

@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);
  }
}

代码示例来源:origin: Justson/AgentWeb

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;
}

代码示例来源:origin: Justson/AgentWeb

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();
    }
  }
}

代码示例来源:origin: robolectric/robolectric

@Test
public void getUrl() throws Exception {
 webView.clearHistory();
 assertThat(webView.getUrl()).isNull();
 webView.loadUrl("fake.url", null);
 assertThat(webView.getUrl()).isEqualTo("fake.url");
}

代码示例来源:origin: TeamNewPipe/NewPipe

myWebView.clearHistory();
android.webkit.CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

代码示例来源:origin: robolectric/robolectric

@Test
public void getOriginalUrl() throws Exception {
 webView.clearHistory();
 assertThat(webView.getOriginalUrl()).isNull();
 webView.loadUrl("fake.url", null);
 assertThat(webView.getOriginalUrl()).isEqualTo("fake.url");
}

代码示例来源:origin: robolectric/robolectric

@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();
}

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldRecordClearHistory() {
 assertThat(shadowOf(webView).wasClearHistoryCalled()).isFalse();
 webView.clearHistory();
 assertThat(shadowOf(webView).wasClearHistoryCalled()).isTrue();
}

代码示例来源:origin: iTXTech/Daedalus

@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;
    }
  }
}

代码示例来源:origin: vic797/prowebview

/**
 * Clear the history and all the back and forward stacks
 */
@Override
public void clearHistory() {
  super.clearHistory();
  backStack.clear();
  forwardStack.clear();
}

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: stackoverflow.com

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");

代码示例来源:origin: stackoverflow.com

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);

代码示例来源:origin: stackoverflow.com

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());

代码示例来源:origin: stackoverflow.com

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());

代码示例来源:origin: Carson-Ho/Webview_Cache

@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();
  }
}

代码示例来源:origin: zfman/hputimetable

@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();
  }
}

代码示例来源:origin: CarlLu/MVPframe

public void clear() {
  if (mWebView != null) {
    mRootView.removeView(mWebView);
    mWebView.clearHistory();
    mWebView.clearCache(true);
    mWebView.destroy();
    mWebView = null;
  }
}

相关文章

WebView类方法