Marat Faskhiev
Marat Faskhiev

Reputation: 1302

openDatabase error at Safari 7

I have the following code in my application:

openDatabase('main', '1.0', 'Database display name', 50 * 1024 * 1024)

It worked fine until Apple introduced Safari 7. Now it fails with the following exception:

SecurityError: DOM Exception 18: An attempt was made to break through the security policy of the user agent.

Does anybody know how it can be solved?

Upvotes: 5

Views: 2669

Answers (2)

Marcin Kossowski
Marcin Kossowski

Reputation: 86

I figgured it out.When you enter safari, a little button on the top left on the keyboard says "private", click it to disable it. The database will work fine, but with the limitations mentioned by marat. But (for jQuery mobile users)! jquery mobile will not be able to use the back button. For this, you have to delete appcache from your code. jquerymobile 1.4 will fix this, but for now you will have to live without appcache!

Upvotes: 0

Marat Faskhiev
Marat Faskhiev

Reputation: 1302

I found an answer. Hope it will be useful for someone else:

http://www.mobilexweb.com/blog/safari-ios7-html5-problems-apis-review

WebSQL bug •Using WebSQL API will have big issues (DOMException) while trying to create a database bigger than 5Mb. On previous versions, the limit was 50Mb with user’s permission. Because of a bug, when you try to store more than 5Mb the user will get a permission dialog but just for 5Mb only. Even if the user grants you permission because it’s for 5Mb only, you will get an exception trying to get more. It’s a BIG BUG.

Update 19/9: According to tarobomb from New York Times, if you request less than 5Mb when you first create the database and then you try to store more data (up to 50Mb) the proper confirmation dialog will appear (first 10Mb, then 25Mb and finally 50Mb) and you will finally be able to store more than 5Mb.

Upvotes: 5

Related Questions