Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created March 22, 2011 19:03
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save ahoward/881817 to your computer and use it in GitHub Desktop.
Save ahoward/881817 to your computer and use it in GitHub Desktop.
// force certain pages to be refreshed every time. mark such pages with
// 'data-cache="never"'
//
jQuery('div').live('pagehide', function(event, ui){
var page = jQuery(event.target);
if(page.attr('data-cache') == 'never'){
page.remove();
};
});
// for pages marked with 'data-cache="never"' manually add a back button since
// JQM doesn't. this is *okay* because we know the browswer history stack is
// intact and goes to the correct 'back' location.
// specified back button - however!
//
jQuery('div').live('pagebeforecreate', function(event, ui){
var page = jQuery(event.target);
if(page.attr('data-cache') == 'never'){
var header = page.find('[data-role="header"]');
if(header.find('[data-rel="back"]').size() == 0){
var back = jQuery('<a href="#" data-icon="back" data-rel="back">Back</a>');
header.prepend(back);
};
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment