CORS + Cordova : issues with : Access-Control-Allow-Origin

前端 未结 4 509
轻奢々
轻奢々 2020-12-08 15:18

I have been searching hours on this issue, but I still can\'t find any solution to this.

I am developping an App cordova (basicely HTML / JS) So : the app runs on mob

4条回答
  •  旧巷少年郎
    2020-12-08 15:59

    I have added following in nodejs server which solves my issue;

    app.use(function(req, res, next) {
        res.header("Access-Control-Allow-Origin", "*");
        res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
        next();
    });
    

    This may be helpful if you are using nodejs.

    Thanks

提交回复
热议问题