Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Okay so the solution was close to the update I posted. The issue with the previous solution was that there were to many things bind-ed to the "Back" button. While my new bind action may have been working sometimes, the other actions would take place too, I tried <code>unbind()</code> but still no worky. </p> <p>My solution is a bit of smoke and mirrors. I check to see if the the previous page was the review page and then if so, I swap out the old back button for my new faux button with the history back step like so:</p> <pre><code>$('div#wine_detail').live('pageshow',function(event, ui){ var last = $.mobile.urlHistory.stack.length - 1; var last_url = $.mobile.urlHistory.stack[last].url; var review_url = /review/g; if (last_url.match(review_url) ) { $('a.ui-btn-left').replaceWith('&lt;a href="" id="time_machine" class="ui-btn-left ui-btn ui-btn-icon-left ui-btn-corner-all ui-shadow ui-btn-up-a" data-icon="arrow-l"&gt;&lt;span class="ui-btn-inner ui-btn-corner-all"&gt;&lt;span class="ui-btn-text"&gt;Back&lt;/span&gt;&lt;span class="ui-icon ui-icon-arrow-l ui-icon-shadow"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;'); $('#time_machine').bind( 'click', function( ) { console.log("click should be bound and going back in time...") window.history.go(-3); }); } else { console.log('err nope its: ' + last_url); } </code></pre> <p>It looks exactly the same, and no one is the wiser. it could probably be improved by using the the jQm method <code>pagebeforeshow</code> so user could never see the swap. Hope this helps someone.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload