6 testRunner
.dumpAsText();
10 document
.getElementById("logger").innerHTML
+= a
+ "<br>";
13 function testStorage(name
, storage
)
15 if ("length" in storage
)
16 log("Storage object " + name
+ " has length");
18 log("Storage object " + name
+ " has key");
19 if ("getItem" in storage
)
20 log("Storage object " + name
+ " has getItem");
21 if ("setItem" in storage
)
22 log("Storage object " + name
+ " has setItem");
23 if ("removeItem" in storage
)
24 log("Storage object " + name
+ " has removeItem");
25 if ("clear" in storage
)
26 log("Storage object " + name
+ " has clear");
31 if ("sessionStorage" in window
) {
32 log("window.sessionStorage exists");
33 testStorage("sessionStorage", window
.sessionStorage
);
34 log("window.sessionStorage == window.sessionStorage: " + (window
.sessionStorage
== window
.sessionStorage
));
35 log("window.sessionStorage === window.sessionStorage: " + (window
.sessionStorage
=== window
.sessionStorage
));
37 log("window.sessionStorage DOES NOT exist");
39 if ("localStorage" in window
) {
40 log("window.localStorage exists");
41 testStorage("localStorage", window
.localStorage
);
42 log("window.localStorage == window.localStorage: " + (window
.localStorage
== window
.localStorage
));
43 log("window.localStorage === window.localStorage: " + (window
.localStorage
=== window
.localStorage
));
45 log("window.localStorage DOES NOT exist");
47 if ("onstorage" in window
)
48 log("window.onstorage exists");
50 log("window.onstorage DOES NOT exist");
55 <body onload=
"runTest();">
56 This test checks to see if window.localStorage, window.sessionStorage and window.onstorage exist.
<br>
57 <div id=
"logger"></div>