ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Handling of Relative Attributes in Href

  • 4 ردود
  • 2 have this problem
  • 5 views
  • آخر ردّ كتبه wychegnome

more options

http://www.w3schools.com/tags/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>".

Why does the expansion fail in this way?

http://www.w3schools.com/tags/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>". Why does the expansion fail in this way?

All Replies (4)

more options

No problems here.

Reload web page(s) and bypass the cache.

  • Press and hold Shift and left-click the Reload button.
  • Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
  • Press "Cmd + Shift + R" (MAC)
more options

Thank you for responding cor-el.

I have since spotted some typos in my page railref.html and 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.

more options

Firefox does not cope because it is not allowed according to webstandards. IE does not think that this is an error because backslashes are normal delimiters on the Windows platform, so they have a workaround for this.

more options

Thank you for the response.

It does seem that Safari also provides a 'work round'. I'm not sure they would have the same excuse as Microsoft though.