WordPress LMS for Web and mobile › Forums › Ionic App Support › Access-Control-Allow-Origin
After running ionic serve in inspect mode shows some errors like:
Access to XMLHttpRequest at ‘https://interlan.app/wp-content/uploads/2019/09/Basic-Course-icon.jpg’ from origin ‘http://localhost:8100’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource
what is this ? should I add some code to .htaccess?
I added some codes but did not solve it like :
Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
Install the Google chrome allow cors extension and use it while building the app.
This is browser restriction because app is running on localhost:8100 and pulling data from yoursite.com which is restricted by browser.