Posts Tagged ‘URL’

Getting and Setting anchors with JavaScript

Something I’ve been playing with recently that’s not very well documented is using JavaScript to retrieve and to update the current page anchor from a URL. It’s very simple to do. In order to retrieve the page anchor (i.e. get test from http://chris-miller.org/88#test: var anchor = self.document.location.hash.substring( 1 ); Setting the anchor to update, for [...]