title: Compare URL with JavaScript
body: <p>I am trying to write a function like this:</p>
  
  <pre><code>if ( document.url!= 'search.php') {
      window.location = 'search.php' 
  }
  </code></pre>
  
  <p>This is not working; it seems I may need to check if URL string contains 'search.php' - or is there another way I can do this check?</p>