PhoneGap iOS + DOM Exception 18

Go To StackoverFlow.com

5

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?

2012-04-04 06:13
by Henry


5

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

2012-04-04 15:23
by Shazron
any solution--- how to handle this - Mayur Birari 2012-06-06 05:13
@shazron- plz have look at this http://stackoverflow.com/questions/9510785/iphone-phonegap-email-composer-security-err-dom-exception-18 , I have the same issue, even though i tried with cordova1_7 still, i got the dom exception after MailComopser dismiss and reloading DB - Mayur Birari 2012-06-07 05:52


1

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.

2012-04-04 06:26
by Warewolf
I also can make it work when it's a fresh install. I feel like the issue is only reproducible when the DB has already been previously created and a new install to the app is made - Henry 2012-04-04 13:47
Ads