如何以编程空浏览器缓存? [英] How to programmatically empty browser cache?

查看:109
本文介绍了如何以编程空浏览器缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找一种方法以编程清空浏览器缓存。我这样做,因为应用程序缓存的机密数据,我想删除这些,当你preSS注销。这或者通过服务器或JavaScript发生。当然,利用外资/公共电脑上的软件仍然是气馁,因为有更多的危险,这样你就不能在软件层面击败按键记录程序。

I am looking for a way to programmatically empty the browser cache. I am doing this because the application caches confidential data and I'd like to remove those when you press "log out". This would happen either via server or JavaScript. Of course, using the software on foreign/public computer is still discouraged as there are more dangers like key loggers that you just can't defeat on software level.

推荐答案

这是可能的,你可以简单地使用jQuery来代替元标记引用同一个事件处理程序/按钮缓存状态,然后刷新,轻松,

It's possible, you can simply use jQuery to substitute the 'meta tag' that references the cache status with an event handler / button, and then refresh, easy,

$('.button').click(function() {
    $.ajax({
        url: "",
        context: document.body,
        success: function(s,x){

            $('html[manifest=saveappoffline.appcache]').attr('content', '');
                $(this).html(s);
        }
    }); 
});

请注意:该解决方案依赖于将作为HTML 5规范的一部分执行的应用程序缓存。它还需要服务器配置来设置应用程序缓存清单。它没有描述由哪一个可以通过客户端或服务器端code,这几乎是不可能做到清除传统的浏览器缓存的方法。

NOTE: This solution relies on the Application Cache that is implemented as part of the HTML 5 spec. It also requires server configuration to set up the App Cache manifest. It does not describe a method by which one can clear the 'traditional' browser cache via client- or server-side code, which is nigh impossible to do.

这篇关于如何以编程空浏览器缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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