title: Checking for exact URL
body: <p>I am having an issue checking for the URL in the pages on my site. 
  This is what I have.</p>
  
  <p>Checking for the exact string works well:</p>
  
  <pre><code>var url = location.pathname;
  if ("url:contains('texas-ignition-interlock')") {
    $("body").addClass("texas-ppc-page");
  }
  </code></pre>
  
  <p>But when I have page url with similar words, both classes were added to both pages.</p>
  
  <pre><code>var url = location.pathname;
  if ("url:contains('texas-ignition-interlock-device')") {
    $("body").addClass("texas-ppc-device-page");
  }
  </code></pre>
  
  <p>I also tried <code>indexOf</code>, and is didn't work do to the pages with similar names.
  This is what I tried, and this works for the first example. Second example will have the first class added too.</p>
  
  <pre><code>if (window.location.href.indexOf("texas-ignition-interlock") &gt; -1) {
    $("body").addClass("texas-ppc-page");
  }
  
  if (window.location.href.indexOf("texas-ignition-interlock-devices") &gt; -1) {
    $("body").addClass("texas-ppc-device-page");
  }
  </code></pre>
  
  <p>Now, I can still use the <code>indexOf</code> version. I would simply target the stuff on one page using the class <code>.texas-ppc-page</code>, and on the second page I would target using both classes of <code>.texas-ppc-page.texas-ppc-device-page</code>.</p>
  
  <p>Is there a better way of doing this with JS or jQuery?</p>