2012-04-01 52 views
1

我有樣本網站:我可以使用應用程序緩存後備爲不同的主機?

/index.html 
/appcache.manifest 
/style.css 
/test.js 

的index.html:

<!DOCTYPE HTML> 
<html manifest="appcache.manifest"> 
<head> 
    <link type="text/css" rel="stylesheet" href="style.css" /> 
</head> 
<body> 
    <div id="map"></div> 
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> 
    <script>window.google && window.google.maps || console.info('Fail');</script> 
</body> 
</html> 

appcache.manifest:

CACHE MANIFEST 

NETWORK: 
* 

CACHE: 
index.html 
style.css 
test.js 

FALLBACK: 
http://maps.googleapis.com/maps/api/js?sensor=false test.js 

test.js:

window.google = window.google || {}; 
google.maps = google.maps || {}; 
console.info('I am work!!!') 

當我打開現場第一次在沒有互聯網連接的本地主機上,我在控制檯中看到'Fial'。

我可以在應用程序緩存清單回退部分中使用http://different_domain,如果我可以做我做錯了什麼?

回答

2

沒有,from the spec

後備命名空間和後備項目必須具有相同的起源 清單本身。

+0

如果一個是絕對的並且一個是相對的(相對於相同的絕對URL評估),它是否允許? – Pacerier 2013-03-26 09:38:36

+0

@Pacerier我不確定,當你嘗試時會發生什麼? – robertc 2013-03-26 11:07:49

+0

它的工作原理,但我想知道什麼關於RFC處方 – Pacerier 2013-03-26 11:33:50

相關問題