Skip to content

Instantly share code, notes, and snippets.

@JavaScript-Packer
Created April 30, 2015 13:16
Show Gist options
  • Select an option

  • Save JavaScript-Packer/5efdf14ae811858172f2 to your computer and use it in GitHub Desktop.

Select an option

Save JavaScript-Packer/5efdf14ae811858172f2 to your computer and use it in GitHub Desktop.
Get complete hash of URL without substring, split/join or indexof
if(window.location.hash) {
alert(window.location.hash.replace("#",""));
//above we simply get rid of the first occurance of #, without global set, only first match dealt with
} else {
alert('no hash for you');
}
//this is a WHAK.com script :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment