Този сайт ще има ограничена функционалност, докато се извършва тече неговата поддръжка. Ако дадена статия не може реши проблема ви и искате да зададете въпрос, нашата общност е готова да ви помогне на @firefox в Twitter и /r/firefox в Reddit.

Търсене в помощните статии

Избягвайте измамите при поддръжката. Никога няма да ви помолим да се обадите или изпратите SMS на телефонен номер или да споделите лична информация. Моля, докладвайте подозрителна активност на "Докладване за злоупотреба".

Научете повече

Handling of Relative Attributes in Href

  • 4 отговора
  • 2 имат този проблем
  • 5 изгледи
  • Последен отговор от 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?

Всички отговори (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.