Sunday, July 10, 2016

Ionic: How to solve CORS issue

What is CORS?
CORS = Cross Origin Resource Sharing

When developing an Ionic app, do you ever get the error: No 'Access-Control-Allow-Origin' header is present on the requested resource

It is caused by an Ajax call (XMLHttpRequest) to another site when you run your app in the browser by the command ionic serve or ionic run. It won't occur when your app is built and load to platform (iOS/Android).

To solve this problem and get your app run smoothly on the browser like on the platform iOS/Android, let use Chrome and install this extension: https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi




Instead of uploading your app to the platform iOS / Android which taking your time. Using above Chrome extension will help you develop and test your app faster.

Happy coding! Welcome any command.

1 comment:

Subscribe to RSS Feed Follow me on Twitter!