title: Using JavaScript to search the URL for hash, not a specific string though
body: <p>I'm looking for a way to search the URL of the page, looking for a specific keyword in the has. </p>
  
  <p>For example, if the hash "/three" exists, I want to run a JavaScript function. The problem though, is that I have eight hashes, and they can be triggered in any specific order. </p>
  
  <p>This means that I can't just do something like this - </p>
  
  <pre><code>&lt;script&gt;
          window.onhashchange = function(){
    switch(location.hash) {
      case '#hide':
        javascript:alert("Find a valid NFC tag to continue!")
      break;
      case '#hide/one':
        javascript:alert("You found piece number one!")
      break;
      case '#hide/two':
        javascript:alert("You found piece number two!")
      break;
      case '#hide/three':
        javascript:alert("You found piece number three!")
      break;
      case '#hide/four':
        javascript:alert("You found piece number four!")
      break;
      case '#hide/five':
        javascript:alert("You found piece number five!")
      break;
      case '#hide/six':
        javascript:alert("You found piece number six!")
      break;
      case '#hide/seven':
        javascript:alert("You found piece number seven")
      break;
      case '#hide/eight':
        javascript:alert("You found piece number eight!")
      break;
    }
  }
          &lt;/script&gt;
  </code></pre>
  
  <p>because the URL might end up being "example.com/index.html#hide/one/five/three/etc..". The way that it's configured right now, is that it'll specifically search for "#hide/one", "#hide/two", etc. </p>
  
  <p>But "#hide" isn't inserted with every hash, only with the first. So there will never be a "#hide/one/#hide/two, etc". </p>
  
  <p>I need to figure out how I can search for "one", "two", "three", etc, in the URL and perform functions accordingly. </p>
  
  <p>Thanks in advance, looking forward to learning more on this!</p>
  
  <p>EDIT - Just read through my post and I feel like I should clarify something. You know the JavaScript function "hash.length"? Something like "hash.length" but for contents, like "hash.content" or something would be great. I don't think that exists though. </p>
  
  <p>-Mitchyl </p>