Jump to content

Relative Anchor Links In Firefox Problem


wychegnome

Recommended Posts

http://www.w3schools.../att_a_href.asp defines the attributes for urls that can be used with the href declaration in an anchor tag. I have been using a relative attribute as set out in that definition within a web site in the form "<a href="ref-mt.html#006">MT006</a>" where the html file called is in the same directory on the web site as the page containing the call. IE and Safari expand this call correctly to "http://www.s-r-s.org.uk/railref/ref-mt.html#006" and the link works as intended. Firefox does so as well when I use my local copy to test before uploading to the web site, BUT Firefox fails to expand correctly when working from the live web site. In these circumstances it expands the call to "http://www.s-r-s.org.uk/ref-mt.html#006" which does not work (page not found error) because the file is not in the root directory of the web site. Interestingly if I alter the HTML code to <a href="../railref/ref-mt.html#006">MT006</a> Firefox does work correctly and, once that call is made it correctly expands all the other similar calls which remain in the form "<a href="ref-mt.html#006">MT006</a>". Has anyone else noticed this quirk and does anyone know why Firefox has this problem when other browsers cope?
Link to comment
Share on other sites

Thank you for responding. Changing the \ to / in the railref.html page has resolved the matter - but still doesn't explain why Firefox didn't cope. IE and Safari didn't fall over on this and correctly expanded the links despite use of \ for / on the railref page.

Link to comment
Share on other sites

You can't predict how browsers will respond to something that is coded wrong. There are no standards for how to interpret things that are coded wrong. Firefox may be attempting to interpret the \ as part of the name of the file. Obviously, Internet Explorer will parse the \ properly because that's Windows' native directory separator. It's possible that Internet Explorer is correcting the URL while Firefox passes the URL as it is, and that the server is the one that doesn't know how to interpret the backslash.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...