2

I have a main page (main.html) in the assets folder that I am displaying with:

webview.setWebChromeClient(new MyWebChromeClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.addJavascriptInterface(new VersionCallbackScript(), "demo");
webview.loadUrl("file:///android_asset/main.html");

and I want to put a link in the document to another html file in assets folder. When I similiarly put in the tag:

<a href="file:///android_asset/secondpage.html">Touch here for page 2</a></font></h4>

and touch it in the client, the screen loads a blank page.

likewise, I want to have a table of contents that isA ListView and uses loadUrl with an html page suffixed with an anchor. I tried and it is not working

String anchor = "subsection1";
webview.loadUrl("file:///android_asset/main.html" + "#" + anchor);

this construct is not working either.

mobibob
  • 8,670
  • 20
  • 82
  • 131

1 Answers1

2

Give a try to the following piece of code

<a href="secondpage.html">Touch here for page 2</a>

For me it does the job.

dotcs
  • 2,286
  • 1
  • 18
  • 26