INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

HTML Bookmark on touch screen

HTML Bookmark on touch screen

(OP)
I have 2 bookmarks on a page, one moves the view from top to bottom, the other moves the view from bottom to top.
On my desktop dev machine, both bookmarks work as expected but on my touch screen phone, only the bottom to top link works.
This is a much simplified version of the original page but still shows the same problem.
Can anyone suggest what the problem may be?

CODE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Bookmark test</title>
</head>
<body>
<div style='font-size:50px;'>
<a href='#bottom'>Bottom</a>
<a name='#top'>
Top
</div>
<div style='height:3000px;'>
BODY 100px high
</div>
<div style='font-size:50px;'>
Bottom
<a href='#top'>Top</a>
<a name='#bottom'>
</div>
</body>
</html> 

Keith
www.studiosoft.co.uk

RE: HTML Bookmark on touch screen

Hi

I would start with this :

Quote (W3C Markup Validation)

🅧 Line 11, Column 6: end tag for "A" omitted, but its declaration does not permit this
🅧 Line 19, Column 6: end tag for "A" omitted, but its declaration does not permit this

Feherke.
feherke.ga

RE: HTML Bookmark on touch screen

(OP)
Sorry, my typo when I simplified the code.
Problem still exists with the omitted tags added.

Keith
www.studiosoft.co.uk

RE: HTML Bookmark on touch screen

Hi

I think some joker here changed my coffee to decaffeinated... How I missed those hashes ( # ) earlier ? They must not be present in the name attributes.

Feherke.
feherke.ga

RE: HTML Bookmark on touch screen

(OP)
I hate it when my beverage is interfered with :)
The hashes were the problem, thanks.
Still a mystery why it works with or without hashes for a mouse click.

Keith
www.studiosoft.co.uk

RE: HTML Bookmark on touch screen

The mysterious difference is not likely between the platforms (desktop/mobile) but between the different browsers running on those platforms... and their different allowances for quirky HTML.

RE: HTML Bookmark on touch screen

HTML never is quirky ;)

https://www.youtube.com/watch?v=-csXdj4WVwA

Some browsers may simply remove the # from names. No idea why mouse vs touch will differ, maybe because most mouse icons are pointier ;^)

Bye, Olaf.

RE: HTML Bookmark on touch screen

(OP)
Thanks Olaf although I now worry that I am becoming a nerd because I enjoyed watching that.

The main point of confusion, for me, was the fact that one worked and the other didn't. If both had failed to work, I think I would have found the solution quickly.

Keith
www.studiosoft.co.uk

RE: HTML Bookmark on touch screen

I fear noone can explain without knowing the exact conditions.

In IE both links worked,
In Firefox and Chrome only the link at the bottom lead me to top, maybe because top is a keyword anyway, even if there is no anchor with that name.
IE might remove # from names automatically, because that is what it thinks of its users...

What html becomes is important, the DOM that is built from the html is what "runs".

So you might do DOM inspection and look at the names these anchors have.

If I change both names to #ttt and #bbb the link to #ttt stops working in Firefox and Chrome, most probably as it's not the keyword top anymore.
It still works in IE, as it may do as I assume and stripe off the # of the names, so href=#name works.

"top" actually is a built in anchor you don't need to define at all, besides <a href="#"> would also mean to navigate to the same page and not specify an anchor name, so it jumps somewhere, and where? Top. Where else should it go?

I'd not worry too much why wrong code works anyway, if you know how to write right code, it's merely a matter of how much quirks a browser accepts and still tries to work. Some of the tolerance IE has leads to more undefined behaviour and quirks than it fixes quirks like unallowed chars in anchor names. I have said in another place my feeling is Mozilla is most strict about w3c standards and IEs bad reputation could actually root in trying to be too tolerant.

Bye, Olaf.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close