Chinaunix首页 | 论坛 | 博客
  • 博客访问: 304996
  • 博文数量: 174
  • 博客积分: 3061
  • 博客等级: 中校
  • 技术积分: 1740
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-04 22:43
文章分类

全部博文(174)

文章存档

2011年(54)

2010年(14)

2009年(30)

2008年(26)

2007年(27)

2006年(23)

我的朋友

分类: WINDOWS

2011-07-12 17:21:41

今天测试html5离线部署的时候发现一个情况。。

html文件如下

 
   
       
               
                  cache  
    
    
   
    
    
     
        
     
      hi sofish!   
         
  


清单文件如下
CACHE MANIFEST
manifest.html
/lib/dojo/dojo.js.uncompressed.js
/test/offline/common/Utils.js   
         
结果发现dojo.require 在关闭apache后老是抛异常,说是无法加载。 但是奇怪的是如果你通过webinspector去查看console的时候又显示utils.js 已经加载。 

并且通过sqlitespy查看cachedb文件发现utils.js文件也存在,path也正确。


后来跟踪进去一看原来

d._isDocumentOk = function(http){
var stat = http.status || 0,
lp = location.protocol;
return (stat >= 200 && stat < 300) || // Boolean
stat == 304 || // allow any 2XX response code
stat == 1223 || // get it out of the cache
// added by lmzhang
stat == 0 ||  
// end
// Internet Explorer mangled the status code
// Internet Explorer mangled the status code OR we're Titanium/browser chrome/chrome extension requesting a local file
(!stat && (lp == "file:" || lp == "chrome:" || lp == "chrome-extension:" || lp == "app:"));
}

红色部分的代码missing之后导致的如果从本地读取了文件将会失败。
阅读(704) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~