kmc*_*kmc 6 html5 caching offline ruby-on-rails
我有一个rails应用程序,我试图使用Rack :: Offline使用HTML5应用程序缓存.application.manifest文件已设置,正在由我的HTML页面下载和检查.清单如下:
CACHE MANIFEST
# 2d9bf2b03a07dc960fd8fe69659ceeffd4d28ccf8619669a506c3682bf223878
404.html
422.html
500.html
login.html
stylesheets/scaffold.css
javascripts/jquery.min.js
javascripts/jquery.js
javascripts/application.js
javascripts/rmbz.js
javascripts/rails.js
images/rails.png
NETWORK:
/
Run Code Online (Sandbox Code Playgroud)
我正在访问的页面是localhost:3000/mobile,它已经缓存得很好(当我取下rails服务器时可以查看).但是,它引用的application.manifest文件已更改(实际上它通过操作注释的十六进制ID随每个请求而更改),但Chrome不更新页面.Chrome中的控制台日志提供以下内容:
Document was loaded from Application Cache with manifest http://localhost:3000/application.manifest
Application Cache Checking event
Application Cache Downloading event
Application Cache Progress event (0 of 12) http://localhost:3000/login.html
Application Cache Progress event (1 of 12) http://localhost:3000/404.html
Application Cache Progress event (2 of 12) http://localhost:3000/422.html
Application Cache Progress event (3 of 12) http://localhost:3000/javascripts/rails.js
Application Cache Progress event (4 of 12) http://localhost:3000/javascripts/rmbz.js
Application Cache Progress event (5 of 12) http://localhost:3000/images/rails.png
Application Cache Progress event (6 of 12) http://localhost:3000/500.html
Application Cache Progress event (7 of 12) http://localhost:3000/javascripts/jquery.js
Application Cache Progress event (8 of 12) http://localhost:3000/stylesheets/scaffold.css
Application Cache Progress event (9 of 12) http://localhost:3000/javascripts/jquery.min.js
Application Cache Progress event (10 of 12) http://localhost:3000/mobile
Application Cache Progress event (11 of 12) http://localhost:3000/javascripts/application.js
Application Cache Error event: Manifest changed during update, scheduling retry
Run Code Online (Sandbox Code Playgroud)
我不太明白为什么会失败.它似乎在做到最后一行之前应该做的一切!如果我在浏览器中导航到localhost:3000/application.manifest,我会得到一个类似的日志 - 似乎清单本身就被缓存了,那么这就是为什么它会抱怨清单已经改变了?有任何想法吗?
谢谢!
我遇到了同样的问题,必须对宝石本身进行更改。我的问题与 /public/images 中的嵌套文件夹有关
首先找到您的 gems 的安装位置(“gem 环境”将为您提供)并导航到 /rack-offline-0.6.1/lib。
编辑文件rack-offline.rb。删除第 33 行并替换为:
"#{root}/images/**/*.png",
"#{root}/images/**/*.jpg",
"#{root}/images/**/*.gif"]
Run Code Online (Sandbox Code Playgroud)
重新启动 Rails 服务器并重试。为我工作,希望对你有帮助。
| 归档时间: |
|
| 查看次数: |
3971 次 |
| 最近记录: |