Nikesh
Nikesh

Reputation: 31

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

I am creating an application using cordova :

openDatabase('testname', '1.0', 'Database display name', 5 * 1024 * 1024)

I am using plugin to signin with facebook https://github.com/wizcorp/phonegap-facebook-plugin , after successfull login I am calling following function

facebookConnectPlugin.api("<user-id>/?fields=id,email", ["user_birthday"],
    function (result) {
        alert("Result: " + JSON.stringify(result));
        /* alerts:
            {
                "id": "000000123456789",
                "email": "[email protected]"
            }
        */

        openDatabase('testname', '1.0', 'Database display name', 5 * 1024 * 1024)

    },
    function (error) {
        alert("Failed: " + error);
    }
});

I am getting an error SecurityError: DOM Exception 18: An attempt was made to break through the security policy of the user agent.

Upvotes: 3

Views: 9049

Answers (1)

Dick van den Brink
Dick van den Brink

Reputation: 14557

Thanks for letting me know what version + platform you have. I had the same issue a few months back and it is due to a bug in cordova on android.

You can find more about the fix here https://github.com/apache/cordova-android/commit/6e4ef508e8f9f2d396515bd1d7465481d2f1285c

There are two possible ways to fix this:

The first one is to update to cordova 3.2, which should be fairly straightforward when you are already on 3.0

The other one is porting this fix to 3.0 which is also possible. In the CordovaChromeClient.java there is a method called "onExceededDatabaseQuota", remove all the logic there and change it to quotaUpdater.updateQuota(MAX_QUOTA);

Upvotes: 0

Related Questions