bfcache_iframe2.html 675 B

123456789101112131415161718192021222324252627282930
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script>
  5. var res = {};
  6. var request = indexedDB.open(parent.location, 2);
  7. request.onblocked = function() {
  8. res.blockedFired = true;
  9. }
  10. request.onupgradeneeded = function(e) {
  11. var db = e.target.result;
  12. res.version = db.version;
  13. res.storeCount = db.objectStoreNames.length;
  14. var trans = request.transaction;
  15. trans.objectStore("mystore").get(42).onsuccess = function(e) {
  16. res.value = JSON.stringify(e.target.result);
  17. }
  18. trans.oncomplete = function() {
  19. parent.postMessage(JSON.stringify(res), "http://mochi.test:8888");
  20. }
  21. };
  22. </script>
  23. </head>
  24. <body>
  25. This is page two.
  26. </body>
  27. </html>