ionic XMLHttpRequest cannot load http://localhost:8080/...
来源:互联网 发布:索爱w580c软件 编辑:程序博客网 时间:2024/06/04 17:45
在ionic项目里http请求访问本地API,出现跨域的问题。错误信息:XMLHttpRequest cannot load http://localhost:8080/Moonlighting/area/getAreas Response to preflight request doesn't pass access control check: A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:8100' is therefore not allowed access. The credentials mode of an XMLHttpRequest is controlled by the withCredentials attribute.
解决步骤:
1.在终端项目目录下输入 cordova plugin add cordova-plugin-whitelist
2.在config.xml里添加 :
<access origin="*"/>
<allow-intent href="*"/>
<allow-navigation href="http://*/*" />
3.关闭chrome浏览器,在图标上右键选择属性,快捷方式,在目标栏目的后面添加 --disable-web-security --user-agent="Android" --user-data-dir="C:/temp-chrome-eng,确定
- ionic XMLHttpRequest cannot load http://localhost:8080/...
- XMLHttpRequest cannot load http://localhost:3000/. No 'Access-Control-Allow-Origin' header is presen
- xmlhttprequest cannot load
- Chrome提示:XMLHttpRequest cannot load
- XMLHttpRequest cannot load file:///D
- XMLHttpRequest cannot load的解决方法
- XMLHttpRequest cannot load 错误解决
- XMLHttpRequest cannot load的解决方法
- XMLHttpRequest cannot load 的解决方法
- XMLHttpRequest cannot load http://xxx. Response for preflight has invalid HTTP status code 404
- XMLHttpRequest cannot load file://app.json. Cross origin requests are only supported for HTTP.
- XMLHttpRequest cannot load http://xxxxxx. No 'Access-Control-Allow-Origin' header i
- XMLHttpRequest cannot load http://XXXx.json. No 'Access-Control-Allow-Origin' header is present on t
- 【问题解决】XMLHttpRequest cannot load http://xxx.xxx No 'Access-Control-Allow-Origin'
- 谷歌调试axios异步请求XMLHttpRequest cannot load http问题解决
- XMLHttpRequest cannot load file. Cross origin requests are only supported for HTTP angularjs
- XMLHttpRequest cannot load 跨域问题解决
- XMLHttpRequest cannot load 跨域问题解决
- Spring+SpringMVC+MyBatis深入学习及搭建(十三)——SpringMVC入门程序(二)
- AngularJs在使用路由时采用ocLazyLoad进行按需加载提高首次页面首次加载速度
- 线程同步
- RecyclerView
- java HTTP请求URL 获取其跳转后地址及参数
- ionic XMLHttpRequest cannot load http://localhost:8080/...
- 对一段有趣代码分析
- Python爬虫-进程池方式爬取头条视频
- 重写
- VS2010 调试窗口一闪而过解决方法
- react-native使用PanResponder实现pinch手势
- 经验
- 在Tomcat中发布web项目
- mui 图片预览(2)