我在Android Chrome浏览器和桌面Chrome浏览器上进行了一些Html5应用程序缓存测试。
清单网址
的 / appcachetest /主要/ AppManifest:
CACHE MANIFEST
# Version: 3
NETWORK:
*
CACHE:
Main
Main/Page1
Main/Page2
Scripts/jquery-1.10.2.js
#FALLBACK:
@{
Layout = null;
Response.ContentType = "text/cache-manifest";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.MinValue);
Response.ContentEncoding = System.Text.Encoding.UTF8;
}
主要索引页面:
<!DOCTYPE html>
<html manifest="/appcachetest/Main/AppManifest" type="text/cache-manifest">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> - My ASP.NET Application</title>
<script src="/AppCacheTest/Scripts/jquery-1.10.2.js"></script>
</head>
<body>
<iframe src="Main/Page1" style="border: 0; width: 100%; height: 100%"> </iframe>
</body>
</html>
我尝试了以下步骤:
刷新页面时是否有任何可用的解决方案从应用程序缓存中加载JavaScript文件?如何使它工作?
谢谢, 博
答案 0 :(得分:1)
经过几个小时的调查和测试。
我发现如果我将文件jquery-1.10.2.js重命名为jquery.js.jgz,那么离线刷新页面不会导致任何错误。
答案 1 :(得分:0)
我终于知道导致无法从Manifest Cache加载JavaScript文件的问题。
Manifest文件中的缓存URL区分大小写,直到花了两天时间我才意识到这一点。