更新时间:2022-12-30 21:49:24
这是可能的,你可以简单地使用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.