2013-10-21 26 views
5

我在我的應用程序下面的代碼:的openDatabase錯誤7

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

它能正常工作,直到蘋果推出Safari瀏覽器7.現在,它失敗,出現以下異常:

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

有誰知道如何解決?

回答

5

我找到了答案。希望這將是爲別人有用:

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.

0

我figgured它out.When你進入Safari,在鍵盤左上角有個小按鈕寫着「私人」,點擊它來關閉它。該數據庫將正常工作,但具有marat提及的限制。但(對於jQuery移動用戶)! jquery mobile將無法使用後退按鈕。爲此,您必須從代碼中刪除Appcache。 jquerymobile 1.4會解決這個問題,但現在你將不得不在沒有appcache的情況下生活!