ionic problem No 'Access-Control-Allow-Origin'

后端 未结 4 794
独厮守ぢ
独厮守ぢ 2020-12-19 00:10

I\'m working on an ionic apps. My problem is: when I try to get data from server I got this:

XMLHttpRequest cannot load https://mywebsite.com/api. No

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-19 00:50

    premise: This issue is usually only running ionic serve, or using ionic as web app, not in ionic as app.

    You can avoid to modify your project and use an extension to disable CORS:

    For developing with chrome, something like this:

    https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi/related

    or, if you need it for firefox, something like this:

    https://addons.mozilla.org/en-US/firefox/addon/cors-everywhere/

    IE and Edge sucks so for these you have to manually disable CORS in settings

提交回复
热议问题