title: JavaScript: Check if window.location.href has been changed
body: <p>I have following code to show a loading panel after e.g. clicking a button and making an Ajax call:</p>
  
  <pre><code>    $(document).on("click", function (e) {
          window.LoadingPanel.Show();
      });
  </code></pre>
  
  <p>After the Ajax call following code makes sure the loading panel disappears again:</p>
  
  <pre><code>    $(document).ajaxComplete(function() {
          if (window.LoadingPanel != null) {
              window.LoadingPanel.Hide();
          }
      });
  </code></pre>
  
  <p>But in some cases I redirect to another page depending on the result of the Ajax call by setting the <code>window.location.href</code>.
  In this case I want the <code>ajaxComplete</code> function NOT to hide the loading panel too early until the redirect has been succeeded.</p>
  
  <p>How can I check in the <code>ajaxComplete</code> function if the window.location.href has been changed and the page is about to redirect?</p>