我與應用程序緩存的工作和我所面臨的問題如下:應用程序緩存在工作的Tomcat 6.0,但不是在weblogic 10.3
在Tomcat服務器:
當服務器處於聯機狀態,如果頁面被首次訪問,清單文件中指定的文件將被成功捕獲到應用程序緩存中。
當服務器處於離線狀態時,當我們嘗試訪問緩存頁面時,瀏覽器控制檯中出現錯誤(根據我在互聯網上的發現,這是非常正常的),但應用程序緩存正常工作。
在WebLogic Server:
我試圖運行在WebLogic Server相同的代碼,在聯機模式下,該文件均與預期緩存。但在離線模式下,第一次加載頁面時,它工作正常,但是當我看到控制檯時,應用程序緩存的狀態變爲OBSOLETE模式,所以如果我再次刷新頁面,它會拋出我一個404錯誤。另外,當我嘗試運行tomcat服務器中的代碼時,我沒有收到"Application Cache Error event: Manifest fetch failed (-1)"
。請讓我知道我做錯了什麼。下面是這些文件:
的index.html
<html manifest="demo.appcache">
<head>
<link rel="stylesheet" href="style.css" type="text/css" />
<script type="text/javascript" src="script.js" ></script>
</head>
<body>
<h1>Basic example of page using Application Cache</h1>
<p>Disconnect from the internet and try to reload this page. It should load without requiring you to connect to the internet.</p>
</body>
</html>
清單文件(demo.appcache)
CACHE MANIFEST
CACHE:
style.css
script.js
index.html
demo.appcache
NETWORK:
*
的style.css
body{
background-color: #333;
}
h1{
color: #c94054;
}
p{
color: #fff;
}
的script.js
if (!window.applicationCache){
alert('It seems that Application Cache is not supported in this browser. Please use a browser which supports it.');
}
的web.xml
<mime-mapping>
<extension>appcache</extension>
<mime-type>text/cache-manifest</mime-type>
</mime-mapping>