How to access a stored HTML5 database from the Objective C part of my app
I'll try to be as clear and direct as possible in the following description: I have to develop an 开发者_开发问答iPad-App that consists of four parts. Three of them have to be written with Objective C, but for the fourth, I considered using a UIWebView in combination with a HTML5 database, if possible.
The question I have is: Is it possible to access a HTML5 database stored locally and used in a UIWebView from outside the UIWebView, i.e. with code written in Objective-C?I didn't try it, but something like this should work :
NSString *myDB = [myWebView stringByEvaluatingJavaScriptFromString:@"
var database = openDatabase(\"My DB\", \"DB Version\");
database.executeSql(\"SELECT * FROM table\", function(result) {
document.write(result);
});
"];
精彩评论