Android Question Anchor link not working in Webview

cbanks

Active Member
Licensed User
Longtime User
Ignore this message. I figured it out.

Why doesn't the following go to the anchor link when the page is loaded in the webview? It just stays at the top of the page and doesn't scroll down to the named anchor. How can I get it to work? It works fine if I tap on a link that is pointing to this url or if I load the link in a browser.

WebView1.LoadUrl("http://alumnihighschool.net/scriptures/bm/1_ne/1.html#1: 15")
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Your anchorname is not allowed.

From SelfHTML (a german HTML reference)

Wahl eines geeigneten Ankernamens
Den Ankernamen können Sie frei vergeben. Vergeben Sie möglichst kurze, aber prägnante und lesbare Namen. Sie sollten im Ankernamen lediglich die lateinischen Buchstaben, die arabischen Ziffern sowie als Sonderzeichen höchstens den Unterstrich (_), den Bindestrich (-) und den Punkt (.) benutzen. Als erstes Zeichen des Namens sollten Sie einen Buchstaben wählen.

How to find the right Anchorname
You could name like you want. Use short, readable names. You should only use chars (a to z), numbers (1 to 0) and the special chars "_" (underscore), "-" (minus) and "." (dot). Any other chars are not allowed. As first character you should use one of a-z

So valid names are for ex.

#myname
#linktoitem15
#c3po

Change your HTML from
B4X:
<a href="1.html#1: 15">15</a>

to

B4X:
<a href="1.html#a15">15</a>

and then you can call your anchor with

B4X:
WebView1.LoadUrl("http://alumnihighschool.net/scriptures/bm/1_ne/1.html#a15")
 
Last edited:
Upvote 0
Top