I need to create the database in blackberry os 5.0 using javascript for phonegap application.
var mydb=false;
function onLoad() {
try {
if (!window.openDatabase) {
alert('not supported');
}
else {
var shortName = 'phonegap';
var version = '0.9.4';
var displayName = 'PhoneGap Test Database';
var maxSize = 65536; // in bytes
mydb = openDatabase(shortName, version,开发者_开发知识库 displayName, maxSize);
}
}
}
It is moving to if condition and only the alert is displayed.But the database is not getting created.Please tell me what's wrong in this code. Thanks in advance!
You have your answer, no? If it's moving to the if
and only the alert
is being displayed, it's never going to go to the else
and create the database, but there's a good reason for that. The if
tests for support. Apparently, BlackBerry OS 5.0 doesn't support databases. You can check this page for a list of polyfills to support HTML5 features in less capable browsers.
BlackBerry 5 is not supported by PhoneGap's openDatabase API.
http://docs.phonegap.com/phonegap_storage_storage.md.html
Supported Platforms
- Android
- BlackBerry WebWorks (OS 6.0 and higher)
- iPhone
HI Recently I had the same problem and I found a cool solution :D BB5 have a "Google Gear" Iternaly in the browser to do that
if (window.openDatabase){
//HTML5
}else{
//try google GEARS
if (window.google || google.gears){
_DB = google.gears.factory.create('beta.database', '1.0');
_DB.open('MyLocalDB');
}
}
精彩评论