title: jQuery Mobile: Getting ID of previous page
body: <p>I basically need a custom function to be used only when, for example, the #reviews page is clicked on from the home page.</p>
  
  <p>Here is the current code I am using:</p>
  
  <pre><code>$(document).bind("mobileinit", function(){
      $('#reviews').live('pagebeforeshow',function(event){
      var cpage = $.mobile.activePage.attr('id');
          if (cpage == 'home') {
              addPages();
          }
      });
  });
  </code></pre>
  
  <p>The problem is, even though it is using 'pagebeforeshow' it is using the id of the page it is about to transition to as the active page, in this case 'reviews' rather than home, thus causing the if statement to fail.</p>
  
  <p>So my question is, in this example, how would i get the id of the previous page, to make sure it is in fact coming from the #home page?</p>