Say, there's a URL http://www.example.com/#hello
- Should
#hello
thing be sent to the web server or not, according to standards? - How do modern browsers act?
Update: Please do not ignore the first question.
Say, there's a URL http://www.example.com/#hello
#hello
thing be sent to the web server or not, according to standards?Update: Please do not ignore the first question.
The anchor part (after the #) is not sent to any $_SERVER variables in PHP. I don't know if there is a way of retrieving that piece of info from the URL or not (as far as I know, it's not possible). It's supposed to be used by the browser only to find a location in the page, which is why the page does not reload if you click on an anchor like so:
<a href="#hello">hello</a>
The hash variables aren't sent to the web server at all.
For instance, a request to http://www.whatismyip.org/#test from Firefox sends the follow HTTP request packet
You'll notice the # is nowhere to be found. Pages you see using # as a form of navigation are doing so through javascript. This parameter is accessible though the
window.location.hash
variableThe answer to this question is similar to the answers for /questions/774136. Basically, according to the standard @ faqs.org/rfcs/rfc1808.html (see Section 2.4.1) it says: ""Note that the fragment identifier is not considered part of the URL." As "stephbu" pointed out, "the the anchor tag is never sent as part of the HTTP request by any browser, it is only interpreted locally within the browser".