How to detect the #hash and get the hash in JavaScript?
Posted on In QAHow to detect the #hash and get the hash in JavaScript? It’s better if no additional library is needed. That said, jquery is fine if it is needed.
You can use this piece of JavaScript code:
if (window.location.hash) {
// hash found
var hash = window.location.hash.substring(1);
} else {
// No hash
}