2012-04-20 46 views
1

我正在使用HTML 5缓存清单,并在Chrome中看到一个非常奇怪的问题。下面是页面的标题:当缓存清单中不存在Chrome服务器资源时,缓存中存在

<html id="html" xmlns="http://www.w3.org/1999/xhtml" manifest="Portal/CacheManifestHandler.ashx"> 

下面是小提琴手捕获的清单内容:

HTTP/1.1 200 OK 
Cache-Control: no-cache 
Pragma: no-cache 
Content-Type: text/cache-manifest; charset=utf-8 
Expires: -1 
Server: Microsoft-IIS/7.5 
X-AspNet-Version: 4.0.30319 
X-Powered-By: ASP.NET 
Date: Fri, 20 Apr 2012 15:56:20 GMT 
Content-Length: 56 

CACHE MANIFEST 
NETWORK: 
* 
#Timestamp: 634705337615835020 

我对里面的标签页面的标题是动态生成服务器上一个特定的脚本。以下是内容返回该脚本代码中的第一次用户访问网页:

HTTP/1.1 200 OK 
Cache-Control: no-cache 
Pragma: no-cache 
Content-Type: text/javascript; charset=utf-8 
Expires: -1 
Server: Microsoft-IIS/7.5 
X-AspNet-Version: 4.0.30319 
X-Powered-By: ASP.NET 
Date: Fri, 20 Apr 2012 15:36:33 GMT 
Content-Length: 74 

document.location='/Portal/Login.aspx?ReturnUrl=%2fPortal%2fDefault.aspx'; 

你可以看到无论是脚本在缓存清单,也不是它的头部允许浏览器(Chrome)缓存它。 当我随后在浏览器中打开同一页面时,Chrome仍然从缓存清单加载页面,这没关系。 然而,令人惊讶的是,它也从缓存加载<脚本>。我可以验证它,因为我的服务器断点没有命中,Fiddler也没有显示请求<脚本>。网络没有关闭,服务器可以访问(这应该没有什么不同,因为Chrome被要求不要缓存这个<脚本>)。

这是预期的行为?不应该从服务器再次请求<脚本>,即使其包含页面是从清单缓存中加载的。

浏览器的Chrome://应用程序缓存,内部也只显示2个网址在缓存这又是罚款,为什么那么它加载<脚本>从缓存中,而不是服务器 Chrome's chrome://appcache-internals also shows only 2 urls in the cache which again is fine, why then it loads the <script> from cache and not the server

+0

你有没有尝试明确设置目标页面设置,而不是使用*? – dhaval 2012-04-23 12:27:18

+0

你能告诉你如何在母版页中包含脚本吗? – pangon 2012-09-02 12:54:58

回答

0

我们有同样的问题,我们的决议是坚持一个*我们app.manifest的网络部分,因此我们的网络部分看起来像

NETWORK: *

现在我挖,看看是否能真的“设计”为Google或公正明显错误。

+0

感谢您答复Josh。不幸的是,我们抛弃了将Cache Manifest用于我们的应用程序的想法,并且我将不再能够对此进行测试。 – 2012-10-06 08:23:50