Vivek Gabadiya
Vivek Gabadiya

Reputation: 244

Android Webview goback() issue with loadDataWithBaseURL method

Issue is goback() not showing my html data back. Steps to produce this issue is like

  1. Loaded html data using method loadDataWithBaseURL. It renders html data fine.
  2. Then click on one link inside html data then webview moves to next page showing that link which is also fine.
  3. When I call method goback() from this page it should show my html data but it is showing me blank screen. Inside onPageFinished() I am getting url as about:blank.

Thanks in advance!

Upvotes: 4

Views: 682

Answers (1)

DnTo ArAn
DnTo ArAn

Reputation: 31

If you use loadDataWithBaseURL you will need to send in the url parameter something different from null, if you send null the url will always be "about:blank"

Example:

var page = new RazorView().GenerateString();
webView.LoadDataWithBaseURL("file:///android_asset/", page, "text/html", "UTF-8", "");
var url = webView.CopyBackForwardList().GetItemAtIndex(1).Url; 
//url  will get the Html From Previous Page

Notice im using C# but it should be the same with java, except for the CapitalizedWords

Upvotes: 1

Related Questions