Not sure if #hashtags NOT sent to the server, but you can develop a workaround with AJAX:
some-page.html
<script type="text/javascript"> $(document).ready(function() { $(window).bind('hashchange', function() { var hash = window.location.hash.substring(1); $.get('ajax-hash.php', { tag: hash }, function(data) { $('#tag').html(data); } ); }); }); </script> <div id="tag"></div> <a href="#one">#one</a> | <a href="#two">#two</a> | <a href="#lolwut">#lolwut</a>
Ajax-hash.php :
<?php $hash = isset($_GET['tag']) ? $_GET['tag'] : 'none'; echo $_SERVER['HTTP_REFERER'] . '#' . $hash; ?>
Note. . It depends on what browser does send HTTP_REFERER . Since this is done through jQuery, it MUST .. but not promises! (Antivirus / firewalls like to remove from your packages)
source share