iOS 4.3.4 中可以使用离线 HTML5 应用程序吗?
我正在尝试为我的 iPad 2(装有 iOS 4.3.4)构建一个 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 并尝试打开应用程序时,我收到可怕的“无法打开,因为它未连接到互联网”警报。
有谁知道 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 的开发人员工具中看到了正确的结果。我收到“应用程序缓存已缓存事件”。它只是无法离线工作。我真的很困惑...
有谁知道有任何页面有完整的代码我可以复制到我的服务器并尝试吗?
谢谢...
I'm trying my hand at building an HTML5 driven offline app for my iPad 2 which has iOS 4.3.4. I followed instructions I've seen on several websites to a tee, and was even able to verify using Chrome's Developer Tools that the cache is working:
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
I have a home screen icon as well as a "startup screen" image in play. I can download the app to the home screen just fine, and I see the icon there. However, when I have the Wi-Fi off and I try to open the app I get the dreaded " could not be opened because it is not connected to the Internet" alert.
Does anyone know if something changed in iOS 4.3.4 (or an earlier version of the OS) that changed the requirements to get this feature of HTML5 working?
Thanks!
Edit
I tried this again outside of a "localhost" setting. This is my 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>
And this is my cache.manifest file's contents:
CACHE MANIFEST
cache-manifest-test.css
cache-manifest-test.js
I see the proper results in Chrome's developer tools. I get the "Application Cache Cached event." It just doesn't work offline. I'm really stumped here...
Does anyone know of any pages that have full blown code I could just copy to my server and try?
Thanks...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您从 Chrome 发布的消息是在从本地主机提供页面时发出的。
使用服务器而不是本地主机检查它是否可以在 Chrome 上运行。
如果没有,请检查您是否为服务器上的应用程序缓存提供正确的类型 (
text/cache-manifest
)。如果您在本地主机上提供正确的类型,但不在服务器上提供正确的类型,则可以解释不同的行为。
另外,我了解到该文件在 iPad 上必须命名为“cache.manifest”。如果您已将其命名为其他名称,请尝试这样做。
The messages you posted from Chrome are when the page is served from localhost.
Check that it works on Chrome using the server rather than localhost.
If it doesn't, check that you are serving the correct type (
text/cache-manifest
) for an appcache on the server.If you're serving the correct type on localhost but not on the server, that would explain the different behavior.
Also, I've read that the file must be named "cache.manifest" on the iPad. If you have named it something else, try that.