由于是静态页面,浏览器缓存或者运营商缓存,造成js修改无法及时执行,由于不是jsp,无法使用taglib标签
方法一:
静态页面的话不用加时间戳也能阻止缓存的,在<head>段加入以下代码:
<meta HTTP-EQUIV="pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<meta HTTP-EQUIV="expires" CONTENT="0">
方法二:
但是只想单独在js或者css链接后加时间戳
<script type="text/javascript">
document.write("<link rel='stylesheet' href='css/public.css?time="+ new Date().valueOf()+"'>")
document.write("<script type='text/javascript' src='js/jquery-1.8.2.min.js?time="+ new Date().valueOf()+"'>")
</script>
网友评论