Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

onobsolete

Summary

The Webpage is associated with an application cache whose group is marked as obsolete.

Property of apis/appcache/ApplicationCacheapis/appcache/ApplicationCache

Syntax

var result = window.applicationCache.onobsolete;
window.applicationCache.onobsolete = value;

Return Value

Returns an object of type nullnull

Examples

Checking fo the obsolete status

// try to trigger an application cache update
window.applicationCache.update();

// Asking the server for the manifest file returned status 404 or 410
// (results in appcache beeing deleted)
if (window.applicationCache.status === window.applicationCache.OBSOLETE) {
   console.log('The cache manifest is gone!');
}

Listening for obsolete events

window.applicationCache.addEventListener('obsolete',function () {
   console.log('The cache manifest is gone!');
}, false);

Notes

If the manifest file can’t be found, the cache is considered to be deleted. If there is more than one event, the obsolete event will be the last one in the sequence. Alternatively, you could use an anonymous delegate function such as

object.onobsolete = function (e) { … }

where e is the cached event.

Attributions

  • Microsoft Developer Network: Article