注销时jQuery清除缓存

web*_*jay 14 javascript jquery caching jquery-mobile

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

我正在考虑的是重定向/注销到清除缓存并重定向到首页的特定页面,但如何清除缓存中的所有内容?

我正在使用jQuery Mobile 1.0b2pre.

web*_*jay 6

这是我解决它的方式:

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

/出口:

<div data-role="page" id="exitPage"></div>
Run Code Online (Sandbox Code Playgroud)

/my.js:

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