Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one disable Caching in jQuery Mobile UI

Tried...

<div data-role="page" data-cache="30">  <div data-role="page" data-cache="never"> <div data-role="page" data-cache="false">  <div data-role="page" cache="false"> 

Nothing seemes to work... so at the moment I'm fixing the problem on the server-side via...

.'?x='.rand() .'&x='.rand() 

I don't want to disable the AJAX just the caching. There has to be a better way though... am I missing something?

Thanks,

Serhiy

like image 988
Serhiy Avatar asked Jan 11 '11 18:01

Serhiy


1 Answers

Thank you for the answers guys, and even though they didn't quite work for me they did point me in the direction to find the code I was looking for.

This is the code that I found on this gentleman's Github Gist.

https://gist.github.com/921920

jQuery('div').live('pagehide', function(event, ui){   var page = jQuery(event.target);    if(page.attr('data-cache') == 'never'){     page.remove();   }; }); 

There is also a back button code in that Gist, but I don't seem to need it really as my back button seems to work just fine...

like image 66
Serhiy Avatar answered Oct 02 '22 16:10

Serhiy