<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Examples</title>
<script src="../js/imgcache.js"></script>
<!-- only for cordova (replace by phonegap.js for phonegap) - ignore on desktop browser -->
<script src="../cordova.js"></script>
<script>
var startTest = function() {
// see console output for debug info
ImgCache.options.debug = true;
ImgCache.init(function() {
console.log('ImgCache initialised');
});
};
if (typeof(cordova) !== 'undefined') {
// cordova test
document.addEventListener('deviceready', startTest, false);
} else {
// normal browser test
window.onload = startTest;
}
</script>
<link rel="stylesheet" href="examples.css">
</head>
<body>
<h1>imgcache.js - example without jQuery</h1>
<div class="clearfix">
<div id="actions">
<ol>
<li>Open page locally (file:// in Chrome) or in Phonegap/Cordova</li>
<li>Work offline</li>
<li>Reload the page (or re-start the web app)</li>
<li>You should see the images reloaded from the cache</li>
</ol>
<p>Check out the console to see what's going on - failure to load cordova is expected</p>
</div>
<div class="note">
<p>Don't forget to accept your browser request to store data on the local computer!</p>
</div>
<div class="note">
<p>If this file is opened in Chrome from a "file://" url, run Chrome with the following flags: <code>--allow-file-access-from-files --allow-file-access</code> in order to <a href="http://stackoverflow.com/questions/6427870/html5-file-api-security-error-while-reading-a-file">avoid a security error</a>.</p>
<p>Otherwise run the page from a web server - <a href="http://updates.html5rocks.com/2011/08/Debugging-the-Filesystem-API">More info</a></p>
</div>
</div>
</body>
</html>