本文介绍了Chrome的跨域读取阻止(CORB)阻止了跨域响应的离子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试验证用户身份,但由于跨域读取阻止(CORB)被阻止,发出我的login.ts代码是
i am trying to authenticate user but i am unable to call an Api due to theCross-Origin Read Blocking (CORB) blocked issue my login.ts Code is
if (this.plugins.isOnline()) {
if (this.wait == true) {
return;
} else if (this.userLogin.email == '' || this.userLogin.password == '') {
this.utility.doToast("Please don't leave any field blank.");
return;
} else {
this.wait = true;
this.auth.login(this.userLogin).subscribe((success) => {
this.wait = false;
console.log(success.successData);
this.credential.setUser(success.successData);
this.plugins.sendTags(success.successData.id)
this.rememberUsertype(success.successData.is_celebrity);
if(success.successData.is_celebrity == '0'){
this.app.getRootNav().setRoot("HomePage");
}
else if(success.successData.is_celebrity == '1'){
this.app.getRootNav().setRoot("DashboardPage");
}
}, (error) => {
console.log(error);
this.wait = false;
if (this.utility.timeOutResponse(error))
this.utility.doToast("The email or password you entered is incorrect.")
})
}
} else {
this.utility.doToast(this.utility.internetConnectionMessage());
}
this.auth.login函数
this.auth.login function
login(params) {
console.log(params);
var url = this.constants.API_ENDPOINT + 'login';
var response = this.http.post(url, params, {}).map(res => res.json());
return response;
}
推荐答案
Allow-Control-Allow-Origin:允许您从任何来源请求带有ajax的任何站点.添加到响应"Allow-Control-Allow-Origin:*"标头
Allow-Control-Allow-Origin:Allows to you request any site with ajax from any source. Adds to response 'Allow-Control-Allow-Origin: *' header
在浏览器中添加此扩展程序:Allow-Control-Allow-Origin
Add this extension in your browser: Allow-Control-Allow-Origin
这篇关于Chrome的跨域读取阻止(CORB)阻止了跨域响应的离子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!