In Firefox 4.0.1 paste the following into the address bar
http://www.w3.org/#one#two
Note that the browser navigates to the w3.org front page and the address bar still reads
http://www.w3.org/#one#two
In Safari 5.0.4 do the same. Note the browser also navigates, but the address bar text is modified to read
http://www.w3.org/#one%23two
Note the first hash appearance of hash in the string is not altered but the second is modified to the encoded form (aka 'escaped') %23.
It seems reasonable to assume that Safari is trying to convert the user-supplied URI to a link that meets its idea of a valid URI. Firefox does not make a conversion in this case.
I would like to account for the difference in behavior.
The document at http://www.ecma-international.org/publications/standards/Ecma-262.htm is one reference to what form a valid URI takes. In section 15.1.3.1 it states the following with respect to unescaping of URIs by browsers.
The character “#” is not decoded from escape sequences even though it is not a reserved URI character.
What it this arguably implies is that it refers to # symbols throughout the URI string, not just the first occurrence.
In conclusion, my question is:
RfC 3986 (the definition of what URIs and thus URLs look like and what the parts mean) does not allow two #
characters in one URL, at least in my reading. Which makes the question boil down to:
Also note that the RfC clearly lists #
as a reserved character, so the ECMA standard is wrong in what you quoted above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With