Read the hash portion of the URL on the server-side application (PHP, Ruby, Python, etc.)


Assuming a URL of:

PHP can read the request variables val1 using the GET array.

Is the hash value part2 also readable? Or is this only upto the browser and JavaScript?

Best Solution

The main problem is that the browser won't even send a request with a fragment part. The fragment part is resolved right there in the browser. So it's reachable through JavaScript.

Anyway, you could parse a URL into bits, including the fragment part, using parse_url(), but it's obviously not your case.