Languages

Menu
Sites
Language
HTML5 Application Cache - Smart TV

I am working on Tizen 3.0 smart tv.
I want to cache few images and js files.

To test the application cache, my demo file looks like this
 

demo.appcache

CACHE MANIFEST
#VERSION 1.0.0
CACHE:
cache_test.js

index.html --

<!DOCTYPE html>
<html manifest="demo.appcache">
<head>
<title>APPCACHE TEST</title>
</head>
<body>
<script src="cache_test.js"></script>
</body>
</html>


But when i run it, the manifest file does not get linked at all. When I execute applicationCache.update() from console, it gives the error "there is no application cache to update".

Please guide me through a simple example of using application cache.

Responses

1 Replies
Armaan-Ul- Islam

You may try changing

cache_test.js  to  ./cache_test.js

 

If still it doesn't work check the state .

var appCache = window.applicationCache;

switch (appCache.status) {
  case appCache.UNCACHED: // UNCACHED == 0
    return 'UNCACHED';
    break;
  case appCache.IDLE: // IDLE == 1
    return 'IDLE';
    break;
  case appCache.CHECKING: // CHECKING == 2
    return 'CHECKING';
    break;
  case appCache.DOWNLOADING: // DOWNLOADING == 3
    return 'DOWNLOADING';
    break;
  case appCache.UPDATEREADY:  // UPDATEREADY == 4
    return 'UPDATEREADY';
    break;
  case appCache.OBSOLETE: // OBSOLETE == 5
    return 'OBSOLETE';
    break;
  default:
    return 'UKNOWN CACHE STATUS';
    break;
};

 

As far as I know applicationCache.update() function is used to redownload cached data.