Skip to content

Instantly share code, notes, and snippets.

@ydkn
Created April 16, 2012 08:59
Show Gist options
  • Save ydkn/2397174 to your computer and use it in GitHub Desktop.
Save ydkn/2397174 to your computer and use it in GitHub Desktop.
HTML5 offline requirements
interface ApplicationCache {
// update status
const unsigned short UNCACHED = 0;
const unsigned short IDLE = 1;
const unsigned short CHECKING = 2;
const unsigned short DOWNLOADING = 3;
const unsigned short UPDATEREADY = 4;
const unsigned short OBSOLETE = 5;
readonly attribute unsigned short status;
// updates
void update();
void swapCache();
// events
attribute Function onchecking;
attribute Function onerror;
attribute Function onnoupdate;
attribute Function ondownloading;
attribute Function onprogress;
attribute Function onupdateready;
attribute Function oncached;
attribute Function onobsolete;
};
ApplicationCache implements EventTarget;
<!DOCTYPE html>
<html lang="en" manifest="/offline.appcache">
<head>
...
</head>
interface NavigatorOnLine {
readonly attribute boolean onLine;
};
CACHE MANIFEST
CACHE:
/index.html
/page1.html
/styles.css
/scripts.js
http://cdn.example.net/logo.png
FALLBACK:
/only_online.html /offline.html
NETWORK:
http://*
https://*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment