Chrome 的跨域读取阻塞 (CORB) 阻止了跨域响应的离子 [英] Chrome' Cross-Origin Read Blocking (CORB) blocked cross-origin response' ionic

查看:256
本文介绍了Chrome 的跨域读取阻塞 (CORB) 阻止了跨域响应的离子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

i am trying to authenticate user but i am unable to call an Api due to the Cross-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 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: Allows to you request any site with ajax from any source. Adds to response 'Allow-Control-Allow-Origin: *' header

Add this extension in your browser: Allow-Control-Allow-Origin

这篇关于Chrome 的跨域读取阻塞 (CORB) 阻止了跨域响应的离子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆