HTML5 App缓存:Manifest已更新,但文件将再次从appcache中获取 [英] HTML5 App Cache: Manifest ist updated but files are taken from appcache one more time

查看:246
本文介绍了HTML5 App缓存:Manifest已更新,但文件将再次从appcache中获取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个缓存清单,里面有评论

I have a cache manifest with a comment in it

# Version 3.2

为了更新所有App我只需更改版本号。它可以工作,但是:

in order to update all the App I simply change the Version number. It works, but:

当我更新清单时,所有内容都正确更新(新缓存已填满),但实际文件从(旧)中再次获取缓存。当我重装两次时,所有内容都会更新。这种行为是否正确?使用chrome 21。

When I update the manifest, everything is updated correctly (new cache is filled) but the actual files are taken ONE more time from the (old) cache. when I reload twice everything is updated. Is this behaviour correct? Using chrome 21.

谢谢

推荐答案

是的,这是目前的正确行为。这就是发生的事情:

Yes, this is the current "correct" behaviour. This is what happens:

当您刚刚对清单文件进行更改并刷新浏览器时,会发生这种情况(假设您在线)

When you just made changes to the manifest file, and you refresh the browser, this is what happens (assuming you're online)


  • 浏览器首先加载缓存中的所有文件

  • 然后浏览器在线检查您的清单文件

  • 它检测到清单文件已更改,然后将继续下载新文件

  • 但是,请记住,此时,你仍然会看着你的'旧文件',因为浏览器在上网之前加载了旧文件以下载'新文件'

  • 如果此时再次点击刷新(第二次),你应该得到'新文件'

  • the browser first loads back all the files in the cache
  • then the browser check online for your manifest file
  • it detects that the manifest file has changed, it will then proceed to download the new files
  • however, keep in mind, at this time, you will still be looking at your 'old files' because the browser has loaded the old files before going online to download the 'new files'
  • if at this point, if you hit refresh again (2nd time), you should get the 'new files'

这是目前的标准行为。有些人放了一些事件处理程序来提示用户再次刷新(第一次刷新后)

This is currently the standard behaviour. Some people put some event handlers to prompt the user to do another refresh (after the 1st refresh)

我个人认为浏览器应负责提醒用户完成下载新文件后再刷新,但是现在,大多数人都从window.applicationCache中放入事件处理程序来触发事件以帮助管理它。

Personally, I think the browser should be responsible to alert the user to make another refresh after finish downloading the new files, but right now, most people put in event handlers from the "window.applicationCache" to fire events to help manage this.

To看一下使用window.applicationCache的例子,请点击这里: http://www.html5rocks.com/en/ tutorials / appcache / beginner /

To look at an example of using window.applicationCache, go here : http://www.html5rocks.com/en/tutorials/appcache/beginner/

它位于更新缓存部分下。

it's under the "Updating the Cache" section.

这篇关于HTML5 App缓存:Manifest已更新,但文件将再次从appcache中获取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆