title: jQuery Mobile changePage in pagebeforeshow Flicker
body: <p>In several of my jQuery Mobile pages, I need to ensure that certain variables are set before allowing the page to show. As such, I check for these variables in the <code>pagebeforeshow</code> event and if they are not present or correct, I call the <code>$.mobile.changePage(...)</code> inside the <code>pagebeforeshow</code> event and then immediately return.</p>
  
  <p>In jQuery Mobile 1.2.1 this seemed to work perfectly. However, now that I'm using jQuery Mobile 1.3.1 I've noticed an odd rendering issue. Now when I call the changePage inside the <code>pagebeforeshow</code> event, it causes jQuery Mobile to transition to the page I requested, then back to the original page, firing the <code>pageshow</code> event, and then finally transitions back to the page I did the changePage to.</p>
  
  <p>While not a major issue, it is a inconvenience and causes unnecessary transitions. Has anyone else encountered this issue and if so, have you been able to prevent the unnecessary transitions and event firing? Thanks!</p>
  
  <p>Example Code:</p>
  
  <pre class="lang-js prettyprint-override"><code>$('#ConditionalPage').on('pagebeforeshow', function () {
      if (!someScopedVariable) {
          $.mobile.changePage('#RegularPage');
          return;
      }
  }
  
  $('#ConditionalPage').on('pageshow', function () {
      ... \\ Code that gets fired even though pagebeforeshow called changePage.
  }
  </code></pre>