使用apple-mobile-web-app-capable和cache.manifest问题

时间:2012-11-16 02:41:14

标签: iphone caching safari iphone-standalone-web-app

所以我有这个简单的html文件

<!DOCTYPE HTML>
<html manifest="cache.manifest"><head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>Test</title>
<meta http-equiv="content-type" content="text/html">
<meta name="HandheldFriendly" content="true">
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">

<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
    <h1>hello</h1>
</body>
</html>

我的cache.manifest就是

CACHE MANIFEST

我在本地服务器(localhost)上运行此网站。我从iphone safari加载它,它工作正常。然后我停止服务器并再次加载它,它可以工作,因为脱机缓存正在完成它的工作。但是...如果我将网站保存为iphone仪表板中的开始图标,然后我尝试打开它,服务器停止它将无法加载。但是......如果我打开服务器至少运行一次(它会工作),那么我可以稍后打开它而没有问题。

看起来即使页面在safari中缓存,它也不会缓存在这个已保存的应用程序中。谁知道怎么解决这个问题?

1 个答案:

答案 0 :(得分:0)

原因是因为Safari使用的是与WebClip不同的缓存。在Safari中缓存的事实并不意味着如果您从中创建webClip,它将被缓存。您需要至少访问一次webclip才能对其进行缓存。