Home >Web Front-end >JS Tutorial >Why Does the Hash Fragment Disappear on the Server?
When navigating a webpage, you may encounter URLs that contain a hash fragment, such as:
http://www.foo.com/page.php?parameter=kickme#MOREURL
However, accessing the server-side reveals that this hash fragment (#MOREURL) is mysteriously absent. Does it exist in a digital void?
The answer is a definitive no. The hash fragment is an exclusive resident of the browser's domain, completely inaccessible to the server. This is ingrained in the HTML standard, regardless of the browser or server-side technology employed.
The server remains oblivious to the hash fragment. It plays no role in its processing, which happens solely within the browser's realm. This is evident from the fact that the server receives only the URI without the fragment, leaving it out of the request and response cycle.
Wikipedia confirms this server-less nature:
"The fragment identifier functions differently than the rest of the URI: namely, its processing is exclusively client-side with no participation from the server."
While the hash fragment enhances the client-side experience, its server-side absence is an unmodifiable fact.
The above is the detailed content of Why Does the Hash Fragment Disappear on the Server?. For more information, please follow other related articles on the PHP Chinese website!