1 function test() 2 { 3 applicationCache.oncached = function() { log("cached") } 4 applicationCache.onnoupdate = function() { log("noupdate") } 5 applicationCache.onerror = function() { log("error") } 6 7 try { 8 var req = new XMLHttpRequest; 9 req.open("GET", "/resources/network-simulator.php?path=/appcache/resources/simple.txt", false); 10 req.send(null); 11 if (req.responseText == "Hello, World!") 12 parent.postMessage("done", "*"); 13 else 14 alert("FAIL, unexpected response: " + ex); 15 } catch (ex) { 16 alert("FAIL, unexpected error: " + ex); 17 } 18 } 19