I have a web-based Android app that uses WebSQL for storage. For some reason, calling openDatabase
at one point (in response to a button click), causes a DOMException
with the message "SECURITY_ERR: DOM Exception 18"
.
Note that I am not using PhoneGap.
The main question I'm asking here is: What are the possible causes for a DOMException 18 on openDatabase
?
Some more details:
This exception only occurs if the database does not exist yet. If it already exists, it works as expected. The function that makes the openDatabase
call is used in another part of the app and works just fine.
What I've tried so far:
EDIT: This is what the command looks like:
db = openDatabase('my_database', '1.0', 'My database description', 5*1024*1024, function() {});
I found that it has to do with the allowed size of the database. If you try to open a db that is larger than 50mb on iOS, you get this error.
According to the spec the spec , it cause by only two
The user agent may raise a SECURITY_ERR exception instead of returning a Database object if the request violates a policy decision (e.g. if the user agent is configured to not allow the page to open databases).
If origin is not a scheme/host/port tuple, then throw a SECURITY_ERR exception
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With