Do I need to add the files who are hosted on CDN inside in manifest file for offline caching?
This a example maniefest file
CACHE MANIFEST
#This is a comment
CACHE
index.html
style.css
NETWORK:
search.php
login.php
FALLBACK:
/api offline.html
But in my project I'm using some files which are hosted on cdn
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css" />
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>开发者_Go百科;
<script src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script>
How to include these cdn files in manifest file?
According to spec you can't include these files because they are not same origin as manifest file.
The manifest
This is the resource corresponding to the URL that was given in a master entry's html element's manifest attribute. The manifest is fetched and processed during the application cache download process. All the master entries have the same origin as the manifest.
As far as I am aware you cannot. According to the W3C documentation all cached content must satisfy the same origin policy. You can read all about it here among other places.
精彩评论