peterbraden / ical.js

ical for javascript
Apache License 2.0
311 stars 117 forks source link

CORS issue, {mode: "no-cors"} doesn't work #88

Open hugoblanc opened 6 years ago

hugoblanc commented 6 years ago

I'm trying to use ical into an Ionic app but the developpement environnement is en local server and the request origin is http://localhost:8100

So when I call fromURL I get the following error message: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled

But even with a call like that ical.fromURL('http://url/cal.ics', {mode: 'no-cors'}, function (err, data) {}) THis doesn't work because the option is not recognize ...

francoisauclair911 commented 6 years ago

You could try using : https://cors-anywhere.herokuapp.com as in ical.fromURL('https://cors-anywhere.herokuapp.com/https://url/cal.ics', {}, function (err, data) {})

hugoblanc commented 5 years ago

https://cors-anywhere.herokuapp.com is perfectly working, but I finally implement my own cors proxy