注销时jQuery清除缓存 [英] jQuery clear cache on logout

查看:300
本文介绍了注销时jQuery清除缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户从我的移动应用程序退出时,如何确保清除缓存?

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?

我正在使用jQuery Mobile 1.0b2pre。

I'm using jQuery Mobile 1.0b2pre.

推荐答案

以下是我解决的方法:

我的 /注销在后端销毁用户会话的操作重定向到 / exit ,其id属性为 exitPage
在我的JavaScript中,我已经要求jQuery Mobile在即将创建该页面时触发。然后我清空DOM并重定向到首页。

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.

/退出:

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

/my.js:

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

这篇关于注销时jQuery清除缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆