jxcore/jxcore-cordova

XMLHttpRequest is not supported

dortamiguel opened this issue · 0 comments

Hi, I found that the XMLHttpRequest is not working in the jxcore-cordova plugin, if you put the following code as a normal script loaded from the index.html everything is fine but if I do it inside the jxcore/app.js it fails.

var XMLHttpFactories = [
    function () {return new XMLHttpRequest()},
    function () {return new ActiveXObject("Msxml2.XMLHTTP")},
    function () {return new ActiveXObject("Msxml3.XMLHTTP")},
    function () {return new ActiveXObject("Microsoft.XMLHTTP")}
];

var xhr = null;
for (var i=0;i<XMLHttpFactories.length;i++) {
    try { xhr = XMLHttpFactories[i](); }
    catch (e) { continue; }
    break;
}
console.log(xhr);
if (!xhr) throw console.log("XMLHttpRequest is not supported");

I have the Content-Security-Policy on my index.html but I don't know where to put it inside the jxcore/app.js.