文件未缓存

时间:2013-05-29 12:47:32

标签: javascript jquery html html5 jquery-mobile

我使用cache.manifest文件在离线状态下查看我的项目,一切正常。

但唯一没有缓存的是我的图库滑块的库。我不知道为什么。

我可以帮我一个人吗?我在三天内尝试过很多东西,但我不明白为什么会这样。已经更改了很多目录,看看问题是否是路径。但没什么用。

注意:我使用两次库,因为我使用index.html中的库和Destaque.html

我要缓存的库是:

elastislide.css
modernizr.custom.17475.js
jquery.elastislide.js
jquerypp.custom.js

我的cache.manifest文件如下所示:

CACHE MANIFEST

index.html
boilerplate.css
master.css
elastislide.css
jquery.mobile-1.3.1.min.css
jquery.bxslider.css
css/shCore.css
css/shThemeDefault.css
flexslider.css
social-likes.css
imagens/Horizontal/HomeHorizontal2.jpg
imagens/Horizontal/2.jpg
imagens/Horizontal/2.2.jpg
imagens/Horizontal/3.jpg
imagens/Horizontal/3.1.jpg
imagens/thumbsContactos/33.jpg
imagens/thumbsContactos/34.jpg
imagens/thumbsContactos/35.jpg
icon/apple-touch-icon-57x57.png
icon/apple-touch-icon-72x72.png
icon/apple-touch-icon-144x144.png
icon/close_pop.png
icon/mail-icon.png
icon/plus2.png
icon/video-icon.png
icon/facebookicon.png
images/bg_direction_nav.png
images/icons-18-black.png
images/icons-18-white.png
images/icons-36-black.png
images/icons-36-white.png
http://www.youtube.com/embed/tqNCu-wPT6k?rel=0
http://www.youtube.com/embed/YtAZU2diFVE?rel=0
jquery-1.9.0.min.js
jquery.mobile-1.3.1.min.js
modernizr.custom.17475.js
jquery.elastislide.js
jquerypp.custom.js
offlinetest.js
js/modernizr.js
social-likes.js
jquery.bxslider.js
respond.min.js
jquery.flexslider.js
modernizr.custom.17475.js
jquery.elastislide.js
jquerypp.custom.js
js/shCore.js
js/shBrushXml.js
js/shBrushJScript.js
Destaque/js/modernizr.custom.17475.js
Destaque/js/jquery.elastislide.js
Destaque/js/jquerypp.custom.js

Network:
*

Fallback:
offline.html

1 个答案:

答案 0 :(得分:2)

您可以使用缓存htaccess。

Ex:.htaccess

ExpiresActive On
ExpiresByType text/html "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType application/json "access plus 0 seconds"

# Feed RSS - 1 hora
ExpiresByType application/rss+xml "access plus 1 hour"

# Favicon - 1 week
ExpiresByType image/vnd.microsoft.icon "access plus 1 week"

# Images, video, audio - 1 week
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"

ExpiresByType video/ogg "access plus 1 week"
ExpiresByType audio/ogg "access plus 1 week"
ExpiresByType video/mp4 "access plus 1 week"
ExpiresByType video/webm "access plus 1 week"

# Webfonts - 1 year
ExpiresByType font/truetype "access plus 1 year"
ExpiresByType font/opentype "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"

# CSS / jScript - 5 days and 2 hours
ExpiresByType text/css "access plus 5 days 2 hours"
ExpiresByType application/javascript "access plus 5 days 2 hours"
ExpiresByType text/javascript "access plus 5 days 2 hours"