title: Execute a javascript function depending on url?
body: <p>I want to change the css of a div depending on the url you are at.</p>
  
  <p>Here is the code I came up with...</p>
  
  <pre><code>&lt;script&gt;
  if (window.location.href == "http://www.example.com/?tab-1") {
      function(){ 
          $('body').css('color','red !important');
      }
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Could someone explain how properly execute a function based on the current url?</p>
  
  <p>Thank you.</p>