0
오프라인으로 작업 할 수 있다고 가정하는 웹 페이지가 있고 localhost에 있고 인터넷에 연결되어 있지 않을 때 완벽하게 작동합니다. 내 서버에서 내 페이지를 호스팅하고 온라인 연결을 끊었을 때 오류가 발생합니다.잡히지 않은 오류 : NotFoundError : DOM IDBDatabase 예외 8 (오프라인)
Uncaught Error: NotFoundError: DOM IDBDatabase Exception 8
request.onsuccess
왜 이런지 모르겠다. 인터넷에 연결되어 있으면 잘 작동합니다. 나는 파이어 폭스와 ie10 온라인과 오프라인 테스트를 통과했다. 그것은 코드를 중 하나를 중단하지 않습니다, 모든 것은 여전히 잘 작동, 그냥 날 오류 던져 및 페이지를 새로 고칠 때 렌더링 할 데이터를 얻지 않습니다. 여기에 불평입니다.
var version = 1;
var request = window.indexedDB.open(webDB.currentProperty, version);
request.addEventListener('blocked', function() { console.log('blocked'); });
console.log(webDB.currentProperty);
request.onsuccess = function (event) {
webDB.database = request.result;
// make transactiona reference to the database with read option (read is the
default option when none is provided)
var transaction = webDB.database.transaction([webDB.currentProperty]);
// hide or show elements after data has been populated
transaction.oncomplete = function() {
console.log("complete");
};
//Get the objectstore (conatains all the object) to do things
var objectStore = transaction.objectStore(webDB.currentProperty);
크롬 버전이 28인지 확인하고 데이터베이스를 열었을 때 블로킹인지 확인했습니다. 그렇지 않습니다.
편집
내가 명시 적에게이 유형의 오류
Uncaught TypeError: Type error
request.onsuccess
가 발생합니다
var transaction = webDB.database.transaction([webDB.currentProperty], "read-only");
읽기 전용 옵션을 제공하는 경우
[여기] (https://developer.mozilla.org/en-US/docs/IndexedDB/Using_IndexedDB)에는 읽기 전용, 읽기 쓰기 및 버전 변경이라고 나와 있습니다. webDB.currentProperty는 영숫자 문자 만 포함되어 있는지 확인하기 때문에 작동합니다. 또한 위와 같이 말했듯이 인터넷에 연결되어있는 동안 완벽하게 작동하지만 한 번 줄을 서면 오류가 발생합니다. 아직까지는 작동하지만 페이지에서 물건을 만든 다음 새로 고치면 사라집니다. –