gpt4 book ai didi

javascript - 清除页面缓存

转载 作者:行者123 更新时间:2023-11-30 06:52:48 25 4
gpt4 key购买 nike

是否可以使用 javascript 清除单个页面上的缓存?我知道 document.location.reload() 会这样做。但是不刷新页面能做到吗?

最佳答案

您可以通过发送适当的 header 或在您的 HTML 上使用这些元标记来告诉它不要缓存您的页面:

<meta http-equiv='cache-control' content='no-cache'> //clear cache
<meta http-equiv='expires' content='0'>//clear cache with some expire time
<meta http-equiv='pragma' content='no-cache'> // no Cache

关于javascript - 清除页面缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32034792/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com