How can you check for a #hash in a URL using JavaScript? by Tarik Simple use of location hash: if(window.location.hash) { // Fragment exists } else { // Fragment doesn't exist }