Question

I developed an hybrid app using AngularJs which works well on iOS. But now I am not able to run on Android, I am using WebSQL and getting and was getting an error :

openDatabase not defined.

Which dissapeared on adding this to webview settings:

webSettings.setDatabaseEnabled(true);

But then this came up:

02-24 03:08:10.687: E/Web Console(31421): Uncaught Error: SECURITY_ERR: DOM Exception 18 

on the same line where I am using openDatabase.

I am not considering changing my database.

Was it helpful?

Solution

How much quota are you trying to grant the database? If it's over the default (or your database later grows to be more that what you requested) and you have not implemented WebChromeClient.onExceededDatabaseQuota then you will get this error.

Also please ensure that the path to the database file is set to somewhere that your app has permission to access with WebSettings.setDatabasePath[2]

[1] http://developer.android.com/reference/android/webkit/WebChromeClient.html#onExceededDatabaseQuota(java.lang.String, java.lang.String, long, long, long, android.webkit.WebStorage.QuotaUpdater)

[2] http://developer.android.com/reference/android/webkit/WebSettings.html#setDatabasePath(java.lang.String)

OTHER TIPS

Maybe this is a security error because it's breaking the Same Origin Policy? Does setting webSettings.setAllowFileAccessFromFileURLs(true) help matters at all?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top