But of course you don't know if the browser implements onhashchange, so what you need to do is rewrite every link to end with !hash instead of #hash. This causes an (easily trackable) GET request to be sent to the server. The server can use mod_rewrite to respond with 302 to the original file with a #hash.