开发者

Browser Cache: If we change something force user to get new version, not local cached version

We make changes often on our website (which uses caching) and sometimes user don't know to refresh a page in order to get the newest copy of it.

If we do update a开发者_如何学JAVA page, how can we force the users browser to know that there is a new server version, and to use that rather than their browsers cached page?


Either you can set an http header to force reload every n'th second. That's the easy way, but you probably don't want this. The second way is to use a javascript asking the server via ajax if there is an update. If so, force a reload.

About the cache, you can set an expire header on the page.


I know the question has been answered, but another way is to set the querystrings at the end of your URL to use a version number:

www.asite.com?version=1.0 //force update
www.asite.com?version=1.1 
www.asite.com?version=1.2 

The browser should request a new cache each time the version number is changed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜