Webview.loadUrl ("about: blank") release

In my application, I have a web view in which I first download any site, for example www.google.com.
Later at the touch of a button I want to clear this webview for which I am doing

webview.loadUrl("about:blank"); 

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

I tried to reinitialize the webview as

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

I also tried

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

But I got the same results, the web view displays google.com
How to clear web browsing? Please suggest. Thanks.

Edit:
On the other hand, before downloading google.com if I do

 webview.loadUrl("about:blank"); 

loads a blank web page.

+8
android webview
source share
3 answers

use webView.clearView(); before uploading a new URL.

also use there are a few things you can do to clear the webview depending on what you want to do:

 webView.clearCache(true); webView.clearHistory(); webView.destroy(); 
+6
source share

for update only, the clearView () method has been deprecated at API level 18.

Use WebView.loadUrl ("about: blank") to reliably reset to view the status and resources of the release page (including any JavaScript running).

+3
source share

try the following: webView.loadData("");

0
source share

All Articles