javascript - 关闭浏览器时清除缓存的代码 [英] javascript - code to clear the cache on closing the browser

查看:198
本文介绍了javascript - 关闭浏览器时清除缓存的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Web应用程序中,我希望java脚本在用户关闭浏览器时清除缓存。

In my web application I wants the java script to clear the cache when the user close the browser.

javascript应该监听事件并清除缓存。

The javascript should listen to the event and clear the cache.

任何人都可以提供示例代码或任何有用的链接吗?

Can anyone please provide me sample code or any useful link?

推荐答案

技术上是不可能的。
您可以做的是告诉浏览器不使用以下元标记缓存页面:

Technically is impossible. What you can do instead is to tell the browser to not cache the page by using the following meta tags:

<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>

这是一篇供参考的文章 http://www.htmlgoodies.com/beyond/reference/article.php/3472881

Here is an article for reference http://www.htmlgoodies.com/beyond/reference/article.php/3472881

这篇关于javascript - 关闭浏览器时清除缓存的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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