js + url fragment from location code example
Example 1: Javascript check for hash in URL
if (location.href.indexOf("#") != -1) {
//current url has a #hash in it
}
Example 2: get hash js
location.hash
if (location.href.indexOf("#") != -1) {
//current url has a #hash in it
}
location.hash