Better HN
topnewbestaskshowjobs
Log inSign up

digeridew

0 karma · joined Jan 4, 2017 (9y ago) · 1 submissions

Submissions

comment 9y ago · link · parent

I have implemented pages that circumvent that detail with AJAX.

  var hash = window.location.hash.substr(1);
Then you just quietly:

   $.ajax( "example.php?hash=" + hash );
No one will ever notice the difference without inspecting their network traffic, and docile, agreeable users will gaze reassuringly at the anchor, and lull themselves to sleep, feeling placated by the presence of the warm glow of the # character in their address bar.

Here, see for yourself:

  data:text/html,<script>alert(window.location.hash.substr(1))</script>#because+anchors+are+always+safe
Paste that into your address bar, and witness the simplicity.