URL Hashtag JavaScript

var hash = window.location.hash;
if (hash) {
  // Fragment exists
  hash = hash.substring(1);
  console.log(hash);
} else {
  // Fragment doesn't exist
}
Matteoweb