webview.loadUrl([关于:空白")问题 [英] webview.loadUrl("about:blank") issue

查看:2661
本文介绍了webview.loadUrl([关于:空白")问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序在最初我加载任何网站,比如www.google.com网页视图。结果
后来一个按钮,点击我要清除这个网页视图,为此我做

In my application I have a webview in which initially I load any website, say www.google.com.
Later on a button click I want to clear this webview, for which I do

webview.loadUrl("about:blank");  

但这样做并不清楚我的web视图,它继续显示google.com

But doing this does not clear my webview, it continues to display google.com

我试图重新初始化的WebView为

I tried to re initialize the webview as

webview = new WebView(this);
webview.loadUrl("about:blank");

我也试过

webview.clearHistory();
webview.loadUrl("about:blank");  

但我得到了相同的结果,web视图显示google.com搜索
我怎样才能清除的WebView?结果
请建议。结果
谢谢。

But I got the same results, the webview displays google.com
How can I clear the webview?
Please suggest.
Thank You.

编辑:结果
在另一方面,装载google.com之前,如果我这样做


On the other hand, before loading google.com if I do

webview.loadUrl("about:blank");  

它加载一个空白网页。

it loads a blank webpage.

推荐答案

使用 webView.clearView(); 然后再加载新的URL

use webView.clearView(); before loading the new URL.

也使用
有一对夫妇的事情可以做,以清除正是取决于你想要做什么的WebView:

also use There are a couple of things you can do to clear the webview depending exactly what you want to do:

webView.clearCache(true);

webView.clearHistory();

webView.destroy();

这篇关于webview.loadUrl([关于:空白")问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆