• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Anchor tags using 'ID' don't work on Android?

Our mobile site (Software tutorials & training | lynda.com) has a list of alphabetized courses. You can get to a letter category by clicking on a letter link, e.g.

Code:
<a href="#tocK">K</a>

This means the URL becomes 'http://betam.lynda.com/subjects#tocK' and the browser scrolls to the 'K' courses, which looks like this

Code:
<li class="tocSection" id="tocK">
   <h2>K</h2>
   ...
</li>

If you were to then click on the back-to-top icon:

Code:
<a class="backtotop" href="#" onclick="window.scrollTo(0,0);return false;">top</a>

or even just manually scroll back to the top of the page and click on the same '#tocK' link, it won't work on an Android phone. But it works fine on iOS.

According to Links in HTML documents, this is acceptable. But we are using XHTML, and there are some claims that the 'name' attribute will be deprecated in XHTML.

These are some phones we found the bug on. iOS works fine.
LG Optimus T
LG Optimus V
HTC Wildfire S
HTC Sensation 4G
Motorola Droid X
Motorola Droid 2
Motorola Droid 2 Global

Is the problem that Android NEEDS the 'name' attribute for these links to work?
 
Back
Top Bottom