V
V
Vasily Vorobyov2015-09-04 14:05:12
Android
Vasily Vorobyov, 2015-09-04 14:05:12

How to jump on anchor in WebView in Android?

There is a webview:

lawTextWebView = (WebView)findViewById(R.id.text_web_view);
        lawTextWebView.setBackgroundColor(Color.WHITE);
        lawTextWebView.loadDataWithBaseURL(null, "<h1 name=\"anchor1\">заголовок 1</h1><h2 name=\"anchor2\"> заголовок два</h2>", null, "utf-8", null);

How do I jump to anchor1 or anchor2 if I'm not loading html from a file (then one could use "file.html#anchor1"), but directly from a string?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xen740, 2015-11-04
@xen740

Have you accidentally tried something like
lawTextWebView.setWebViewClient(new WebViewClient());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question