当我们多次访问同一个页面,如果url都没变(参数都不变),而且浏览器允许缓存的时候,那么我们读的可能就是缓存了,当我们做了某些CSS改变,可能就不能立即体现了,还是显示之前的页面。
解决办法
在url后面加一个timestamp时间戳,保证每次的url都是变化的,这样就不会读取浏览器缓存了。
以servlet为例,加入我们重定向一个路径:
Timestamp time = new Timestamp(new Date().getTime());
response.sendRedirect("/qoe/app/report/index.html?username=" + URLEncoder.encode(username,"utf-8") + "&type=" + type + "&time=" + time);
在需要重定向的url后面拼接一个时刻都在变化的时间戳,保证url每次请求都不一样即可。