#819959 links2: Does not jump to fragments of the current documents

Package:
links2
Source:
links2
Description:
Web browser running in both graphics and text mode
Submitter:
Axel Stammler
Date:
2017-11-12 11:03:03 UTC
Severity:
normal
#819959#5
Date:
2016-04-04 10:00:25 UTC
From:
To:
Dear Maintainer,

If the user clicks on a link created by something like <a href='#crash>, Links does not
jump to the existing <div id='crash'> element but reloads the document.

#819959#10
Date:
2016-04-04 10:50:16 UTC
From:
To:
Hi Axel,

Axel Stammler wrote:

Just to be sure, you mean "<a href='#crash'>", not "<a href='#crash>".
(Note the missing single quote.)

As far as I know, "href='#crash'" is only intended to work with "<a name='crash'>",
not with "id='crash'" in arbitrary tags.

		Regards, Axel

#819959#17
Date:
2017-11-11 23:02:24 UTC
From:
To:
Hi, Axel ;)

Thanks for your tips! You are right, of course, I do mean "<a href='#crash'>", and I have
changed "<div id='crash'>" to "<div id='crash' name='crash'>" — unfortunately to no avail,
the problem persists.

Regards,

Axel

#819959#24
Date:
2017-11-11 23:53:54 UTC
From:
To:
Hi Axel, :-)

Dr. Axel Stammler wrote:

Ok, I tried to reproduce the issue with the following example file:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>819959.html</title>
  </head>
  <body>
    <h1>Example for #819959</h1>

    <a href='#crash'>'#crash'</a>
    <a href="#crash2">"#crash2"</a>
    <a href='#crash3'>'#crash3'</a>
    <a href="#crash4">"#crash4"</a>

    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 
    <br> <br> <br> <br> <br> <br> <br> 

    <div id='crash'>id='crash'</div>
    <div id="crash2">id="crash2"</div>
    <div name='crash3'>name='crash3'</div>
    <div name="crash4">name="crash4"</div>
  </body>
</html>

Unexpectedly #crash and #crash2 work, and #crash3 and #crash4 don't.

That's exactly the opposite of what I expected ("name=" being the
classic jump targets for "href=#") and also the opposite of what your
bug report says.

elinks and lynx both show the same behaviour. I've tried all three
browsers on Debian 7 Wheezy, Debian 8 Jessie (from where your original
report seem) and on Debian Unstable. (Debian 9 Stretch and Debian
Unstable at least have the same links2 upstream version, so that
behaviour shouldn't have changed inbetween.)

It would be nice if you cold check the above HTML code against your
system and check if you still can reproduce the issue with that code.
(If you can't reproduce it neither with that code, please attach the
file in question where this issue occurs.)

		Regards, Axel

#819959#31
Date:
2017-11-12 10:59:56 UTC
From:
To:
Hi,

Your file produces the same results here. Wikipedia
(https://en.wikipedia.org/wiki/HTML_element) gives an example using ‘id’:

   To illustrate: the header of a table of contents section on example.com could be turned
   into a target by writing

   <h1 id="contents">Table of contents</h1>

   Continuing with this example, now that the section has been marked up as a target, it can
   be referred to from external sites with a link like

   <a href="http://example.com#contents">see contents</a>

   or with a link on the same page like:

   <a href="#contents">contents, above</a>

In my own case, the problem is not that Links does not try to jump. On the contrary, it
does, but first it reloads the document without preserving form variables. As the document
is PHP-generated, the reloaded document shows an empty log-in form that does not contain
the jump target. Links just shows this page whereas Elinks reports an error (“The
requested fragment "#crash" doesn't exist.”).

I think Links (and Elinks, &c.) should just perform a jump within the already loaded
document as Firefox and Chromium do. Such jumps are correctly performed if I save the
document as a local HTML file first and then call Links on that file.

Regards,

Axel