【问题标题】:Cordova WhiteList does not allow access to my ServerCordova WhiteList 不允许访问我的服务器
【发布时间】:2017-03-27 04:30:03
【问题描述】:

我无法连接到我的数据库,因为我的 URL 被拒绝。我要访问的网址是这样的:

http://192.168.0.16/checkUser.php?nombre=asi&clave=1234

我有一些结构相同的 url,我已经在我的 config.xml 文件中尝试过,但没有成功。

<access origin="*" />
<access origin="http://192.168.0.16" subdomains="true" />

<access origin="http://192.168.0.16/*"/>

这是我创建路径并调用函数以连接到我的数据库的完整代码:

function pullUser(userName,apodo,secondName,lastName,pass1,userMail){
    var method='GET';
    var url = appConstants.requestpullUserURL();
    //alert('cogidaUrl: '+ url);
    var path = url + "?nombre="+userName+"&apodo="+apodo+"&apellido1="+secondName+
    "&apellido2="+lastName+"&email="+userMail+"&clave="+pass1;
    console.log(path);
    //alert('El path es: '+ path);
    var xhr = new XMLHttpRequest(); 
    xhr.onreadystatechange = function(){
        //alert('onready. readyState:'+xhr.readyState+' status: '+xhr.status);
        if(xhr.readyState == 4 && xhr.status == 200){
            resp = xhr.responseText;
            //alert('Registro completado');
            transitionLog();
            }else{
                //alert('devuelve false');
                return false; 
            }
    }
    xhr.open(method, path, true); //Creamos la peticion
    resp = xhr.send(); // FALLA AQUI SIN SERVER
    alert('despues del send');
}

谢谢。

【问题讨论】:

标签: php cordova cordova-plugins whitelist


【解决方案1】:

我解决了,添加了白名单插件。我不知道为什么当我创建项目时没有添加自己。我的应用程序目录上的这个 bash 代码解决了它:cordova plugin add https://github.com/apache/cordova-plugin-whitelist.git

【讨论】:

    猜你喜欢
    • 2015-10-19
    • 2016-08-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多