check if url has hash javascript code example
Example 1: javascript change url hash
window.location.hash = '#hash_value';
Example 2: Javascript check for hash in URL
if (location.href.indexOf("#") != -1) {
//current url has a #hash in it
}
window.location.hash = '#hash_value';
if (location.href.indexOf("#") != -1) {
//current url has a #hash in it
}