Tag: http basic authentication

当基本auth用户名有@符号(ios / cordova)时,Jquery .ajax失败

我有一个带jQuery 1.9.1的phonegap应用程序,只要用户名中没有“@”符号(比如在电子邮件地址中),工作得很好。 它只在iOS上失败。 我怀疑它可能不会对@符号或其他东西进行urlencoding。 iPhone , 它永远不会遇到任何回调(完成,失败或总是),Wireshark显示请求没有到达服务器 。 Chrome桌面 :运行正常。 Android ,运行正常。 $.ajax({ url: “https://” + this.hostname + “/alertusmw/services/rest/” + endPoint, type: method, dataType: ‘json’, contentType: ‘application/com.alertus-v1.0+json’, cache:false, username: this.username, password: this.password, beforeSend: function (xhr) { xhr.setRequestHeader(“Authorization”, “Basic ” + $.base64.encode(this.username + “:” + this.password)); }, data: options.data }).done(function(response) { console.log(“DONE: ” + method + […]