2016-09-27 6 views
3

マイキャッシュマニフェストファイルには、次のようになります。ネット:: ERR_FAILEDネットワーク項目のmanifest.cache

CACHE MANIFEST 

calendar.html 
scripts/jquery.js 
scripts/calendar.js 

NETWORK: 

https://apis.google.com/js/client.js 

マイcalendar.htmlのようなものになります。私はキャッシュのすべての作品を無効にした場合

<html manifest="calendar.cache"> 
    <head> 
    <script src="scripts/jquery.js" type="text/javascript"></script> 
    <script src="scripts/calendar.js" type="text/javascript"></script> 
    <script src='https://apis.google.com/js/client.js?onload=checkAuth'></script> 
    </head> 
    <body> 
    <div id="authorize-div" style="display: inline"> 
     <span>Authorize access to Google Calendar API</span> 
     <!--Button for the user to click to initiate auth sequence --> 
     <button id="authorize-button"> 
     Authorize 
     </button> 
    </div> 
    <pre id="output"></pre> 
    <script> 

    $(document).ready(function(){ 

     console.log("ready"); 
    }) 
    </script> 
    </body> 
</html> 

を良い。しかし、キャッシュを有効にすると、apis.google.com/js/client.jsファイルでエラーが発生します。エラーはjquery.js:5 GET https://apis.google.com/js/client.js?onload=checkAuth&_=1474962265124 net::ERR_FAILEDです。これはGoogle Chromeのブラウザ用ですが、Firefoxと同様のエラーが表示されます。私は何が欠けていますか?

答えて

2

これは、client.jsに渡すパラメータが原因です。 ?onload=checkAuth

ウェブでは、要求は限りブラウザとしてunique.Soを考えられている任意のパラメータを渡すたびに同じ

https://apis.google.com/js/client.js // script A 
https://apis.google.com/js/client.js?onload=checkAuth //script B ≠ script A 

しかしcalendar.cacheであなただけ宣言したマニフェストで宣言された関係のスクリプトされていないですスクリプトAはnon-cached.Soとして今は問題に解決するだろう以下にマニフェスト変更を推測することができます

CACHE MANIFEST 
calendar.html 
scripts/jquery.js 
scripts/calendar.js 

NETWORK: 
https://apis.google.com/js/client.js?onload=checkAuth 

OFCだけでも、あなたはcallback.Justはentiを拭く必要としないで、ケース仕事ができるonload=checkAuthを取り除きますマジックを見るためにキャッシュし直してください!