离线 iOS 网络应用程序:加载我的清单,但不能离线工作 [英] Offline iOS web app: loads my manifest, but doesn't work offline

查看:19
本文介绍了离线 iOS 网络应用程序:加载我的清单,但不能离线工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个可在 iOS 上离线使用的网络应用程序.我创建了一个清单,将其作为 text/cache-manifest 提供,并且在 Safari 中运行时通常可以正常工作.

I'm writing a web app to be used offline on iOS. I've created a manifest, am serving it up as text/cache-manifest, and it usually works fine, when running inside Safari.

如果我将它作为应用程序添加到我的主屏幕,然后打开飞行模式,它根本无法打开应用程序 - 我收到错误消息并提示关闭应用程序.(我认为这就是离线应用的全部目的!)

If I add it as an app to my home screen, then turn on Airplane mode, it can't open the app at all -- I get an error and it offers to close the app. (I thought this was the entire purpose of an offline app!)

  • 当我第一次在线加载应用时,我可以在日志中看到它正在请求清单中列出的每个页面.

  • When I load the app a first time when online, I can see in my logs that it's requesting every page listed in the manifest.

如果我关闭飞行模式并加载应用程序,我可以看到它请求的第一个文件是我的 main.html 文件(它都列在清单中,并且具有 manifest=... 属性).然后它会请求清单和我的所有其他文件,获得 200 的所有文件(以及在此加载期间第二次请求的任何内容的 304).

If I turn off Airplane mode, and load the app, I can see the first file it's requesting is my main.html file (which is both listed in the manifest, and has the manifest=... attribute). It then requests the manifest, and all my other files, getting 200's for all (and 304's for anything requested a second time during this load).

当我在 Chrome 中加载页面并单击时,日志显示它试图在服务器上访问的唯一内容是/favicon.ico"(这是 404,我没有无论如何,认为iOS Safari会尝试加载).清单中列出的所有文件均有效且无错误地提供.

When I load the page in Chrome, and click around, the logs show the only thing it's trying to reach on the server is "/favicon.ico" (which is a 404, and which I don't think iOS Safari tries to load, anyway). All of the files listed in the manifest are valid and served without error.

Chrome 检查器在应用程序缓存"下列出了我所期望的所有缓存文件.整个文件集大约 50 KB,远低于我发现的任何离线资源限制.

The Chrome inspector lists, under "APPLICATION CACHE", all the cached files I've listed which I expect. The entire set of files is about 50 KB, way under any limit on offline resources that I've found.

这应该可行吗,即,我是否应该能够仅使用 HTML/CSS/JS 创建离线 iOS 应用程序?我该去哪里弄清楚为什么它无法离线工作?

Is this supposed to work, i.e., am I supposed to be able to create an offline iOS app using only HTML/CSS/JS? And where do I go about figuring out why it's failing to work offline?

(相关但对我来说听起来不太一样,因为它是关于 Safari 而不是独立应用程序:无法让网络应用在 iPod 上离线工作")

(Related but doesn't sound quite the same to me, since it's about Safari and not a standalone app: "Can't get a web app to work offline on iPod")

推荐答案

我确认 name 'cache.manifest' 解决了 IOS 4.3 中的离线缓存问题.其他名称根本不起作用.

I confirm that name 'cache.manifest' solved the offline caching problem in IOS 4.3. Other name simply did not work.

这篇关于离线 iOS 网络应用程序:加载我的清单,但不能离线工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆