| <!DOCTYPE html> |
| <script> |
| |
| function databaseOpened(event) { |
| var getRequest = event.target.result.transaction(["foo"], "readwrite").objectStore("foo").put("value from detached iframe", "key"); |
| getRequest.onsuccess = getRequestCallback; |
| getRequest.onerror = unexpectedErrorCallback; |
| } |
| |
| function openDatabase(event) { |
| parent.detachIframe(); |
| var openRequest = window.indexedDB.open("detached-iframe.html"); |
| openRequest.onsuccess = databaseOpened; |
| openRequest.onblocked = openDatabase; |
| } |
| |
| window.addEventListener("message", openDatabase, false); |
| |
| </script> |