【问题标题】:Are offline HTML5 apps possible in iOS 4.3.4?iOS 4.3.4 中是否可以使用离线 HTML5 应用程序?
【发布时间】:2011-10-30 01:12:08
【问题描述】:

我正在尝试为装有 iOS 4.3.4 的 iPad 2 构建一个 HTML5 驱动的离线应用程序。我按照在几个网站上看到的说明进行操作,甚至能够使用 Chrome 的开发者工具验证缓存是否正常工作:

Creating Application Cache with manifest http://localhost/experiments/test.manifest
Application Cache Checking event
Application Cache Downloading event
Application Cache Progress event (0 of 2) http://localhost/experiments/offlineApp.js
Application Cache Progress event (1 of 2) http://localhost/experiments/offlineApp.css
Application Cache Progress event (2 of 2)
Application Cache Cached event

我有一个主屏幕图标以及一个“启动屏幕”图像。我可以很好地将应用程序下载到主屏幕,并且在那里看到图标。但是,当我关闭 Wi-Fi 并尝试打开应用程序时,我收到可怕的“无法打开,因为它没有连接到 Internet”警报。

有谁知道 iOS 4.3.4(或更早版本的操作系统)是否发生了改变,从而改变了实现 HTML5 的这一功能的要求?

谢谢!

编辑

我在“localhost”设置之外再次尝试了这个。这是我的 HTML:

<!DOCTYPE html>
<html lang="en" manifest="/experiments/cache.manifest">
    <head>
        <meta charset="utf-8"/>
        <title>cache.manifest test</title>
        <link rel="stylesheet" href="cache-manifest-test.css"/>
        <link rel="apple-touch-icon" href="icon.png"/>
    </head>
    <body>
        <h1>cache.manifest</h1>
        <p>Let's see if this thing works...</p>
        <script src="cache-manifest-test.js"></script>
    </body>
</html>

这是我的 cache.manifest 文件的内容:

CACHE MANIFEST
cache-manifest-test.css
cache-manifest-test.js

我在 Chrome 的开发者工具中看到了正确的结果。我收到“应用程序缓存缓存事件”。它只是无法离线工作。我真的被难住了……

有谁知道我可以将完整代码复制到我的服务器并尝试的任何页面?

谢谢...

【问题讨论】:

  • 如果对您之前的问题有帮助,您应该接受一些答案。如果您不知道如何操作,可以查看the FAQ
  • @WTP - 它让我忘记了。谢谢提醒。
  • @jtbandes - 我看了你提到的那个问题,那里提供的解决方案都没有帮助我的情况...... :-(

标签: ios html ios4 ipad-2 manifest.cache


【解决方案1】:

您从 Chrome 发布的消息是从 localhost 提供页面时的消息。

使用服务器而不是本地主机检查它是否可以在 Chrome 上运行。

如果没有,请检查您是否为服务器上的应用缓存提供正确的类型 (text/cache-manifest)。

如果您在 localhost 而不是在服务器上提供正确的类型,则可以解释不同的行为。

另外,我读到该文件必须在 iPad 上命名为“cache.manifest”。如果您将其命名为其他名称,请尝试。

【讨论】:

  • 感谢您的回复!我明天在办公室试试,看看是否有效。非常感谢。
猜你喜欢
  • 1970-01-01
  • 2012-04-04
  • 1970-01-01
  • 2017-05-23
  • 2013-09-01
  • 1970-01-01
  • 2015-11-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多