@adonnini wrote:
I’m new to ionic, (I’m training from 1 week). I would like to develop an RSS parser app running both on browser and on devices (iOS and Android). I’m using ionic4 angular7.
Due to CORS error I’m using @ionic-native/http/ngx as suggested in this post.
I added browser “device” to my app and I run:# ionic cordova run browserThe code is very simple, in home.module.ts:
import { HTTP } from '@ionic-native/http/ngx'; ... constructor(private http: HTTP) { } ... ionViewWillEnter() { this.http.get(this.url, {}, {}) .then(data => { console.log(data.status); console.log(data.data); console.log(data.headers); }) .catch(error => { console.log(error.status); console.log(error.error); // error message as string console.log(error.headers); }); }And the error is:
Access to XMLHttpRequest at '...the url...' from origin 'http://localhost:8000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.What is the way to bypass CORS error also with browser?
Posts: 1
Participants: 1