1 if (!window.indexedDB) {2 window.alert("Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available.")3 } else {4 alert("Your browser supports a stable version of IndexedDB");5 }6 7 var request = window.indexedDB.open("MyTestDatabase", 8);8 var db=null;9 10 request.onerror = function(event) {11 // Do something with request.errorCode!12 alert("Error! "+request.errorCode);13 };14 request.onsuccess = function(event) {15 // Do something with request.result!16 db = request.result;17 alert('success '+db);18 };19 20 request.onupgradeneeded = function(event) {21 alert('upgrade'+this);22 //var objectStore = db.createObjectStore("myconfig", { keyPath: "key" });23 //alert(db);24 25 alert('Upgrading...');26 }27 28 29 //var transaction = db.transaction(["customers"], "readwrite");30
Este ShareCode tiene versiones:
- IndexedDB Test https://developer.mozil... (24/04/2013)
- IndexedDB Test https://developer.mozil... (24/04/2013)
- IndexedDB Test https://developer.mozil... (24/04/2013)
- IndexedDB Test https://developer.mozil... (24/04/2013)
Enlace
El enlace para compartir es: