I have a WebView
in my app with wrap_content
width and height
Before I use webview.loadData
, the width and height of the it wa
What about loadUrl("about:blank"), and then clearHistory()?
I found this answer, pretty helpful: How do I clear a WebView's content before loading a page?
It is for Cocoa, but basically just call:
webView.loadUrl("about:blank")
The only complete solution is to check for SDK version.
if (Build.VERSION.SDK_INT < 18) {
webView.clearView();
} else {
webView.loadUrl("about:blank");
}
I used the clearView() method, however I'm now having issues that when I loadData() right after it, it doesn't seem to load the data.
WebView.clearView();
This will clear the view from the webview.
use following statement before loadData:
view.loadUrl("javascript:document.open();document.close();");