admin管理员组

文章数量:1334152

I'm going a window.onerror "SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent." Each time I load my iOS PhoneGap app. THe app uses local storage and webSQL. I have isolated this error to be throw when I open my db using: db = window.openDatabase("db", "1.0", "Test DB", 1000000);

I haven't had this issue before and my code hasn't changed - this just came out of now where. I've been looking at the iOS 5.1 web view storage bugs and fear it may be related.

Help?

I'm going a window.onerror "SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent." Each time I load my iOS PhoneGap app. THe app uses local storage and webSQL. I have isolated this error to be throw when I open my db using: db = window.openDatabase("db", "1.0", "Test DB", 1000000);

I haven't had this issue before and my code hasn't changed - this just came out of now where. I've been looking at the iOS 5.1 web view storage bugs and fear it may be related.

Help?

Share Improve this question asked Apr 4, 2012 at 6:13 HenryHenry 1,0651 gold badge10 silver badges19 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

It's a confirmed Apple bug in iOS 5.1. Details here in this PhoneGap/Cordova issue tracker: https://issues.apache/jira/browse/CB-347

I have used this and It is working perfectly.Try this

try { 
if (!window.openDatabase) { 
        alert('not supported'); 
} else { 
        var shortName = 'WineDatabase'; 
        var version = '1.0'; 
        var displayName = 'PhoneGap Test Database'; 
        var maxSize = 655367; // in bytes 
        mydb = openDatabase(shortName, version, displayName, maxSize); 
    }
} catch(e) { 
// Error handling code goes here. 
if (e == INVALID_STATE_ERR) { 
        // Version number mismatch. 
        alert("Invalid database version."); 
} else { 
        alert("Unknown error "+e+"."); 
} 
return; 
} 

EDIT:

At that time I was using Phonegap on ios.So I hadn't get it,Now on blackberry phonegap I am getting same issue and and found the cause that: while datacable is plugged app is not able to write anything on SDCard.So I unplugged it and run working fine.Sorry buddy not the solution for ios But people who are searching this issue for blackberry can use this solution.

本文标签: javascriptPhoneGap iOSDOM Exception 18Stack Overflow