KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a WebView in my Android App that is loading an HTML string using the loadDataWithBaseURL() method. The problem is that local anchor links ( <a href="#link"> ...) are not working correctly. When the link is clicked, it becomes highlighted, but does not scroll to the corresponding anchor. This also does not work if I use the WebView's loadUrl() method to load a page that contains anchor links. However, if I load the same URL in the browser, the anchor links do work. Is there any special handling required to get these to work for a WebView? I am using API v4 (1.6). There isn't much to the code, here are the relevant parts of some test code I've been working with: WebView detailBody = (WebView) findViewById(R.id.article_detail_body); String s = "<a href=\"#link\">LINK!</a><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><a name=\"link\"></a>Testing!"; detailBody.loadDataWithBaseURL(API.HomeURL(this), s, "text/html", "utf-8", "");
Tags (comma-separated)
Save Edits
Cancel