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:
- Reducing the size of the database - shouldn't be an issue since it's being created by another part of the app.
- I've checked the external storage permissions - again, shouldn't be an issue.
- I read somewhere that the USB cable being plugged in could cause this issue - not what's causing it in this case.
EDIT: This is what the command looks like:
db = openDatabase('my_database', '1.0', 'My database description', 5*1024*1024, function() {});