How to open Database in Mobile Safari from JS loaded from disk

We have an iPhone application that is essentially a web site encapsulated in an app. This app loads the HTML and JS files from the local disk and interaction is done in JS.

However, with iOS 4.2, the JS has started receiving "SECURITY_ERR: DOM Exception 18" when opening a database, and as a result, our app doesn't work at all. The exact same file worked fine in prior versions of iOS and works fine when loaded from a web server.

Is there a way to configure iOS to permit JS running in a local file to access a database?

Thank you!



I believe that you are exceeding the 5mb limit size for the Database.

At least that's the only way i can find to replicate that error message.

The browser normally prevents a runaway web application from using excessive local resources by setting limits on the size of each site’s database. When a database change would cause the database to exceed that limit, the user is notified and asked for permission to allow the database to grow further.

If you know that you are going to be filling the database with a lot of content, you should specify an ample size here. By so doing, the user is only asked for permission once when creating the database instead of every few megabytes as the database grows.

The browser may set limits on how large a value you can specify for this field, but the details of these limits are not yet fully defined.

I guess I should answer this question since I did finally get an answer from Apple Developer Support confessing this to be a bug in iOS4.

The specific problem is when you load a webView using [webView loadData...]. When loaded this way, webKit does not allow access to databases. If the same call is changed to use [webView loadRequest...] databases are permitted.

There is sample code to demonstrate the problem here:

The same bug, by the way, exists in Google Chrome, which also uses webKit. When loading a web site from a local file in Chrome, databases and AJAX calls are forbidden, but when loading from a web server they are permitted.

Need Your Help

Creating a login using sql in java

java sql swing netbeans login

I am trying to figure out why my code is getting sent to the exception catch block and how to make this part of my log-in work correctly. The problem seems to be in Class.forName(driver); While

Spring autoGrowNestedPaths not working

spring-mvc collections

I have a List of objects with nested properties and at the bottom of the hierarchy each object has a CommonsMultipartFile property.