Cache.manifest работает впервые, а затем не работает
Я пытаюсь добавить html 5 кэширование в веб-приложение, ничего сложного не просто images/css/js.
Когда я загружаю страницу после редактирования файла cache.manifest, я получаю следующую отладку в Chrome 8:
Creating Application Cache with manifest http://example.com/themes/zenmobile/cache.manifest
Application Cache Checking event
Application Cache Downloading event
Application Cache Progress event (0 of 26) http://example.com/themes/zenmobile/plugins/img/toolbar.png
Application Cache Progress event (1 of 26) http://example.com/themes/zenmobile/plugins/img/greenButton.png
Application Cache Progress event (2 of 26) http://example.com/themes/zenmobile/plugins/jqtouch.transitions.js
Application Cache Progress event (3 of 26) http://example.com/themes/zenmobile/plugins/img/back_button_clicked.png
Application Cache Progress event (4 of 26) http://example.com/themes/zenmobile/plugins/img/button.png
Application Cache Progress event (5 of 26) http://quizible.com/sites/all/modules/jquery_update/replace/jquery.min.js
Application Cache Progress event (6 of 26) http://example.com/themes/zenmobile/plugins/img/grayButton.png
Application Cache Progress event (7 of 26) http://example.com/themes/zenmobile/plugins/img/chevron_circle.png
Application Cache Progress event (8 of 26) http://example.com/themes/zenmobile/plugins/img/on_off.png
Application Cache Progress event (9 of 26) http://example.com/themes/zenmobile/plugins/jqtouch.js
Application Cache Progress event (10 of 26) http://example.com/themes/zenmobile/layout.css
Application Cache Progress event (11 of 26) http://example.com/themes/zenmobile/plugins/img/chevron.png
Application Cache Progress event (12 of 26) http://example.com/themes/zenmobile/plugins/img/rowhead.png
Application Cache Progress event (13 of 26) http://example.com/themes/zenmobile/zenmobile.css
Application Cache Progress event (14 of 26) http://example.com/themes/zenmobile/plugins/img/loading.gif
Application Cache Progress event (15 of 26) http://example.com/themes/zenmobile/plugins/img/redButton.png
Application Cache Progress event (16 of 26) http://example.com/themes/zenmobile/plugins/img/activeButton.png
Application Cache Progress event (17 of 26) http://example.com/themes/zenmobile/images/bg_body.png
Application Cache Progress event (18 of 26) http://example.com/themes/zenmobile/plugins/theme.css
Application Cache Progress event (19 of 26) http://example.com/themes/zenmobile/plugins/img/toggle.png
Application Cache Progress event (20 of 26) http://example.com/themes/zenmobile/plugins/img/whiteButton.png
Application Cache Progress event (21 of 26) http://example.com/themes/zenmobile/plugins/img/toggleOn.png
Application Cache Progress event (22 of 26) http://example.com/themes/zenmobile/plugins/jqtouch.css
Application Cache Progress event (23 of 26) http://example.com/themes/zenmobile/plugins/img/button_clicked.png
Application Cache Progress event (24 of 26) http://example.com/themes/zenmobile/plugins/img/back_button.png
Application Cache Progress event (25 of 26) http://example.com/themes/zenmobile/plugins/img/blueButton.png
Application Cache Progress event (26 of 26)
Application Cache Cached event
Когда я снова обновляю страницу, все css/images/js не загружаются, а журнал консоли выводится:
Document was loaded from Application Cache with manifest http://example.com/themes/zenmobile/cache.manifest
Application Cache Checking event
Application Cache NoUpdate event
Затем загрузка "не удалось загрузить ресурс"
Кроме этого вывода, я не нашел ничего полезного, чтобы попытаться исправить это. Кто-нибудь видел это раньше?
Ответы
Ответ 1
Была та же проблема. Положив это внизу, я исправил это для меня:
NETWORK:
*
И чтобы обойти проблемы, с которыми большинство людей сталкиваются с явными обновлениями, этот подход работает для меня очень хорошо:
Прикрепите файл манифеста и все кэшированные ресурсы с номером версии в URL-адресе, а также установите содержимое манифеста для ссылки на этот номер версии. Например:
<html manifest="path/to/cache.manifest?v=42">
и
CACHE MANIFEST
#rev ?v=42
/css/foo.css?v=42
/css/bar.css?v=42
/js/script.js?v=42
Я автоматизировал это для нас, поэтому при новом развертывании я просто подниму номер на 1 (где-то в файле настроек, который я прочитал), и это затронуто во всех упомянутых файлах. Каждый запрос браузера не только обнаруживает изменение файла манифеста, но также вызывает перезагрузку (и кэширование) каждого упомянутого ресурса, таким образом, обновление всего приложения.
Ответ 2
html5 манифестации трудно справиться. Если он работает в одном браузере, он может не работать в другом
1) Посмотрите вкладку ресурсов, чтобы узнать, какой ресурс вызывает ошибку (используя firebug или webkit)
2) Я обнаружил, что изменение имени манифеста при каждом развертывании помогает убедиться, что браузер обнаружил изменения.
Ответ 3
Вы загружаете другие ресурсы, которые не находятся в вашем файле манифеста? Попробуйте перечислить их все и посмотрите, есть ли у вас проблема.