Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
107
rated 0 times [  110] [ 3]  / answers: 1 / hits: 16358  / 13 Years ago, thu, july 14, 2011, 12:00:00

When users logout from my mobile app, how can I make sure the cache is cleared?



What I'm thinking about is to redirect /logout to a specific page that clears the cache and redirects to the front page, but how do I clear everything from the cache?



I'm using jQuery Mobile 1.0b2pre.


More From » jquery

 Answers
126

Here's how I solved it:



My /logout action where the users session is destroyed in the backend redirects to /exit which has an id attribute of exitPage.
In my JavaScript I have asked jQuery Mobile to trigger when that page is about to be created. I then empty the DOM and redirects to the front page.



/exit:



<div data-role=page id=exitPage></div>


/my.js:



jQuery('#exitPage').live('pagebeforecreate', function(){
jQuery(document).empty();
window.location.replace('/');
});

[#91181] Wednesday, July 13, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dakotahs

Total Points: 605
Total Questions: 104
Total Answers: 113

Location: Hungary
Member since Wed, Nov 9, 2022
2 Years ago
;