离线iOS Web应用程序:加载我的清单,但不能脱机工作 [英] Offline iOS web app: loads my manifest, but doesn't work offline
问题描述
我正在编写一个可在iOS上离线使用的网络应用。我创建了一个清单,我将其作为 text / cache-manifest
提供,并且在Safari中运行时通常可以正常工作。
如果我将它作为应用程序添加到我的主屏幕,然后打开飞行模式,它根本无法打开应用程序 - 我收到错误,它提供关闭应用程序。 (我认为这是离线应用程序的全部目的!)
-
当我第一次在线加载应用程序时,我可以在我的日志中看到它正在请求清单中列出的每个页面。
-
如果我关闭飞行模式,并加载应用程序,我可以看到它请求的第一个文件是我的main.html文件(它在清单中列出,并且具有
manifest = ...
属性)。然后它会请求清单和我的所有其他文件,为所有文件获取200(并且在此加载期间第二次请求304)。 -
当我在Chrome中加载页面,然后点击左右,日志显示它尝试访问服务器上的唯一内容是/favicon.ico(这是一个404,而我认为iOS Safari并未尝试加载它) )。在清单中列出的所有文件都是有效的并且没有错误地提供。
Chrome检查器在APPLICATION CACHE下列出所有缓存文件,已列出我期望的。整个文件集大约是50 KB,在我找到的离线资源的任何限制下。
这应该是工作,即,我应该能够创建一个离线iOS应用程序只使用HTML / CSS / JS?
(相关,但对我来说听起来不太一样,因为它是关于Safari而不是一个独立应用程序:无法获取网络应用程序)
我确认名称'cache.manifest'解决了离线缓存问题。 IOS 4.3。其他名称根本不起作用。
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.
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).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.
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.
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?
(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")
I confirm that name 'cache.manifest' solved the offline caching problem in IOS 4.3. Other name simply did not work.
这篇关于离线iOS Web应用程序:加载我的清单,但不能脱机工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!