Skip to content

Instantly share code, notes, and snippets.

@jimmyhillis
Created December 19, 2012 10:33
Show Gist options
  • Save jimmyhillis/4335817 to your computer and use it in GitHub Desktop.
Save jimmyhillis/4335817 to your computer and use it in GitHub Desktop.
Simple function to return the #hash_component and nothing else from a URL string which can contain as much or little of a URL in any order.
function _hash(url_string) {
var a = document.createElement('A');
a.href = url_string;
return a.hash.split('?')[0].split('&')[0];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment