As you do not elaborate/know on how the anchors/hashes are generated on the server side, all I can give you is a JS solution (proof of concept): if (window.location.hash) { alert(window.location.hash.substring(1)); }