1 <html> 2 <head> 3 <script> 4 function handleStorageEvent(e) 5 { 6 parent.log("Subframe received storage event:"); 7 parent.log("Key - " + e.key); 8 parent.log("New Value - " + e.newValue); 9 parent.log("Old Value - " + e.oldValue); 10 parent.log("url - " + parent.normalizeURL(e.url)); 11 parent.log("Storage Area - " + ((e.storageArea == window.sessionStorage) ? "This window's window.sessionStorage" : "Another window's window.sessionStorage")); 12 parent.log(""); 13 14 if (e.key != "Subframe") { 15 parent.log("Subframe about to change sessionStorage..."); 16 sessionStorage.setItem("Subframe", "SET"); 17 } 18 } 19 </script> 20 </head> 21 <body onload="window.addEventListener('storage', handleStorageEvent, false);"> 22 This is the subframe which exists to make sure that both frames of a same security origin receive the event for that origin's sessionStorage object mutating 23 </body> 24 </html> 25