title: how to fire a callback before redirect?
body: <p>I want to write a global method for my site.</p>
  
  <p>That when the page jumps to another, before the redirection acts, show a waiting mask on the page.</p>
  
  <p>So I'm wondering if there is some way to get an event before the redirect?</p>
  
  <p>The following code explains what I want to do, but doesn't work.</p>
  
  <pre><code>$(function() {
      $(document).on('before_redirect', function() {
          // show the waiting mask.
      });
  });
  </code></pre>
  
  <p>The answer can not be so neat, I just want the <strong>GLOBAL METHOD</strong>, once this piece of javascript included, no need to write anything other place.</p>
  
  <p>Pray for good solution!</p>