Why Is My Onupgradeneeded Callback Never Called When Connecting To Indexeddb?
Solution 1:
I tested this in FF 10 and it worked for me. (Until the code tried to use the undefined "db" variable".)
What browser are you using? The upgradeneeded event is only raised in FF 10. Chrome 16 still uses the old draft where you have to check the db.version property and call db.setVersion if it's not what you want.
If you are using FF10, are you sure that "mydb" isn't already created?
Also, be sure that you're testing this through a real web server. FF won't let you use indexedDB with local HTML files. If that's happening, you should see an error like "The operation failed for reasons unrelated to the database itself and not covered by any other error code" in your console.
Solution 2:
You didn't define the db variable
I have the same problem... this is the code from MDN, and they didn't explain how to update the DB version without the setVersion() function
Post a Comment for "Why Is My Onupgradeneeded Callback Never Called When Connecting To Indexeddb?"