无法让网络应用在iPod上脱机工作 [英] Can't get a web app to work offline on iPod
问题描述
我已经编写了一个基本的密码管理器类型web应用程序,以在移动设备上离线运行(在第4代iPod Touch上进行测试)。我已将应用程序添加到主屏幕,并且在iPod处于联机状态时它可以正常工作,并且可以连接到服务器。一旦我将iPod置于离线状态,当我打开应用程序时,出现以下对话框:
无法打开PwdThing
PwdThing无法打开,因为它未连接到互联网。
单个静态HTML文件
< html manifest =cache.manifest>
...
cache.manifest
文件包括应用程序使用的所有文件(包括 jQuery Mobile 文件):
CACHE MANIFEST
passwordthing.html
passwordthing.js
...
并且 cache.manifest
文件设置为 text / cache-manifest
在 .htaccess
文件中:
AddType文本/缓存清单.manifest
所有源文件都在< github (这个提交是写作时的版本),我已经设置了公共服务器来安装它
为什么我无法让我的应用程序脱机工作?
我能想到的唯一的事情就是你没有改变文件,移动Safari浏览器缓存了旧版本的清单。为您的清单添加评论。您可能还想尝试更改清单文件本身的名称;我必须这样做才能让我的iPad缓存 - 每次我更新我的应用程序时,我都会更改清单的名称以包含日期。
请注意iOS4。 2有更好的明确支持。您可能会看到情况有所改善。
编辑 - 或者事实证明,它只是一个错误的文件名。 ;)(见关于问题的评论)。
I've written a basic password manager type web application to run offline on a mobile device (testing on a 4th gen iPod Touch). I've added the app to the Home Screen and it all works fine while the iPod is online and can reach the server. Once I put the iPod offline, when I open the app the following dialog comes up:
Cannot Open PwdThing
PwdThing could not be opened because it is not connected to the Internet
The single static HTML file for the app (passwordthing.html
) points to the manifest file:
<html manifest="cache.manifest">
...
The cache.manifest
file includes all the files used by the app (including the jQuery Mobile files):
CACHE MANIFEST
passwordthing.html
passwordthing.js
...
And the cache.manifest
file is set up to be served as text/cache-manifest
in the .htaccess
file:
AddType text/cache-manifest .manifest
All the source files are on Github (this commit is the version at the time of writing) and I have set up a public server to install it from as well.
Why can't I get my app to work offline?
The only thing I can think of is that you have not changed the file, and mobile safari has cached an old version of the manifest. add a comment to your manifest. You might also want to try changing the name of the manifest file itself; I have had to do that to get my IPad to cache -- everytime I update my application I change the name of the manifest to include the date.
Note that iOS4.2 has much better manifest support. You might see things improve when it is out.
Edit -- Or, as it turns out, its just a bad file name. ;) (see comments on question).
这篇关于无法让网络应用在iPod上脱机工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!