Created
January 30, 2014 15:48
-
-
Save chengmu/8711499 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
if (!window.openDatabase) { | |
alert('not supported'); | |
} else { | |
var shortName = 'mydatabase'; | |
var version = '1.0'; | |
var displayName = 'My Important Database'; | |
var maxSize = 65536; // in bytes | |
var db = openDatabase(shortName, version, displayName, maxSize); | |
// You should have a database instance in db. | |
} | |
} catch(e) { | |
// Error handling code goes here. | |
if (e == 2) { | |
// Version number mismatch. | |
alert("Invalid database version."); | |
} else { | |
alert("Unknown error "+e+"."); | |
} | |
return; | |
} | |
alert("Database is: "+db); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment