开发者

Howto compare a file in the cache with the file in the server

I have a flash movie that displays a list of movies. It uses an xml file to get this list. The xml file changes frequently. I'd like to know if there's a way with JavaScipt, to compa开发者_如何学运维re the xml file in the cache and the one in the server, if they are different, the script alerts the user and then refreshes the page. thanks in advance


The easiest way to do this is keeping a version number in a browser cookie. Every time you write a new set of data to the server, increase the counter by 1. If the version number in the cookie doesn't match the counter variable, you need to load the page again.

Another way would be to set an "expires" header in the HTML page. See this tutorial on web caching.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜