Search code examples
androidwebviewloaddata

Android v2.2-2.3.5: WebView : loadDataWithBaseURL : will only load page once


When I'm loading a page using .loadData or .loadDataWithBaseURL, the system will load a page once.

After that, subsequent calls do not work.

In 4.0.3, if I were to call the function a second time with new data, it does change.

How can I fix this for 2.2+? Do I destroy the webview and create a new one?

webView1.loadDataWithBaseURL("file://", page, "text/html", "UTF-8", null);
webView1.loadUrl( "javascript:window.location.reload( true )" );

Solution

  • In loadDataWithBaseURL, set the last parameter to the URL where that data came from, instead of null.