ruby-on-rails – HTML5应用程序清单不清除清单更改上的缓存

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – HTML5应用程序清单不清除清单更改上的缓存前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个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:
/

我正在访问的页面是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

我不太明白为什么会失败.它似乎在做到最后一行之前应该做的一切!如果我在浏览器中导航到localhost:3000 / application.manifest,我会得到一个类似的日志 – 似乎清单本身就被缓存了,那么这就是为什么它会抱怨清单已经改变了?有任何想法吗?

谢谢!

解决方法

我遇到了同样的问题,不得不改变宝石本身.我的问题与/ public / images中的嵌套文件夹有关

首先找到你的宝石安装位置(“宝石环境”会告诉你)并导航到/rack-offline-0.6.1/lib.

编辑文件rack-offline.rb.删除第33行并替换为:

"#{root}/images/**/*.png","#{root}/images/**/*.jpg","#{root}/images/**/*.gif"]

重新启动rails服务器,然后重试.为我工作,希望它能帮到你.

原文链接:https://www.f2er.com/ruby/264745.html

猜你在找的Ruby相关文章