我现在已经迷上了两天,这让我发疯。希望有人可以阐明这个问题。
我正在运行: Mavericks (MAC),Safari Versie 7.0.3 (9537.75.14)
我的 index.php
看起来像:
<!DOCTYPE HTML>
<html manifest="manifest.php">
<head>
<title></title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<p>The time is <time><?php echo time(); ?></time></p>
</body>
</html>
我的 style.css
看起来像:
html, body
{
margin : 0;
padding : 0;
font-size : 100%;
font-family : "Helvetica Neue", Helvetica, Verdana, Arial, sans-serif;
}
p
{
text-align : center;
}
p time
{
color : red;
}
我的 manifest.php
看起来像:
<?php header('Content- Type: text/cache-manifest'); ?>
CACHE MANIFEST
CACHE:
style.css
如果我跟踪时间输出,它表明它有效,因为除非 list 更改,否则时间不会更新。我在 Chrome 中加载 URL 并且它有效,我在 Mobile Safari 中加载 URL 并且它有效!我在 Mavericks 上的 Safari 中加载 URL,然后发生了一些古怪的事情。
时间未按预期更新。当我查看控制台时,我看到它有一个程序缓存。然而,当我断开与互联网的连接并重新加载页面时,一切似乎都很好。它确实重新加载页面而没有给出我离线的错误,但是没有加载任何外部文件,如 CSS,并给出以下错误,包括 list 本身:
加载资源失败:网络连接离线。
同样,Chrome 和 Mobile Safari 使用相同的 URL 也能正常工作。我看不到我错过了什么。
最佳答案
尝试将 list 文件扩展名更改为 .appcache:
<html manifest="manifest.appcache">
关于html - 如何让应用程序缓存 list 在 Safari 7.0.3 上运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22912919/