【问题标题】:html5 offline cache, not working with some dynamic content that uses htaccesshtml5 离线缓存,不适用于某些使用 htaccess 的动态内容
【发布时间】:2011-07-08 11:42:07
【问题描述】:

我正在尝试对页面进行离线版本,但动态生成的页面没有缓存。

当我重新启动浏览器并打开离线模式时,我无法访问 search.html(它是动态内容页面,由 YII 框架创建)

但我可以访问所有静态文件,如 css 和 js。

我拥有的东西:

.htaccess

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

RewriteRule ^admin admin.php

cache.manifest

CACHE MANIFEST


CACHE:

/
/search.html
/index.php
/css/screen.css
/css/print.css
/css/main.css
/css/form.css
/assets/aa1d1537/jquery/css/redmond/jquery-ui.css
/css/jquery.lightbox-0.5.css
/assets/6e74162b/jquery.js
/js/main.js
/images/spacer.gif
/js/lightbox/jquery.lightbox-0.5.min.js
/js/lightbox/init.js

在 html 标签中显示

  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" manifest="/cache.manifest">

有什么想法我应该怎么做?

【问题讨论】:

  • 您确定没有向 search.html 添加查询字符串。喜欢 /search.html?q=question。如果您(临时)创建一个静态 search.html 文件会发生什么?

标签: php html .htaccess offline


【解决方案1】:

我猜你已经检查过了,否则你将无法看到 css 等,但是你是否配置了你的 apache 服务器(如果你正在使用这个)来正确地服务清单?

例如添加一个包含以下内容的 .htaccess 文件

AddType text/cache-manifest .manifest

【讨论】:

    【解决方案2】:

    与动态生成的页面一起发送一些缓存信息。

    例如见this page(除了关于HTTPS的那一点——这是完全错误的)

    【讨论】:

    • 此链接与HTML5离线存储无关,是关于php缓存技术的...
    猜你喜欢
    • 1970-01-01
    • 2011-12-28
    • 1970-01-01
    • 2011-08-15
    • 2012-09-16
    • 1970-01-01
    • 2014-07-27
    • 2010-11-15
    • 2015-05-05
    相关资源
    最近更新 更多