关于浏览器页面缓存问题

问题描述

通过FTP直接将项目上传到服务器,然后访问链接调试,发现修改的样式没有生效,以为是代码没有上传成功过,一直疯狂调试。

解决方法

一、采用<meta>的方式效果并不是太好

<meta http-equiv="Pragma" content="no-cache">

<meta http-equiv="Cache-control" content="no-cache">

<meta http-equiv="Cache" content="no-cache">

二、使用css添加版本参数,完美解决style缓存问题 例如: 在css的Url后面加上参数version=1.0.0,每次提交时修改一下版本号就可以了

<link rel="stylesheet" type="text/css" href="../style/css/common-red.css?version=1.0.0">

猜你喜欢

转载自www.cnblogs.com/brock/p/11673173.html