Reputation: 1172
I have a HTML5 app. Which runs fine in a browser. And fine when wrapped up as an iOS app. However when I build for Android I am getting the following message when debugging through adb.
XMLHttpRequest cannot load file:///android_asset/www/data/translations.json. Origin null is not allowed by Access-Control-Allow-Origin. at null:1
This occurs when I call try to load the file with $.getJSON
Apparently this can be resolved in JAVA with
if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
webView.getSettings().setAllowUniversalAccessFromFileURLs(true);
}
However, I need a way to do this in a HTML5 app wrapped up with phonegap. How can I turn this setting on?
Upvotes: 1
Views: 1250
Reputation: 1172
Updating to the lastest (at time of posting 2.8.1) cordova jar resolved the issue.
Upvotes: 1