XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.
2016-07-05 09:11
621 查看
报错:跨域
XMLHttpRequest cannot load http://localhost:8080/admin/admin/store. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '
http://xxx:8088' is therefore not allowed access.
网上查了查有两种解决方法
在测试的时候是别的地址来访问的,所以在获取session的时候,把地址改成 http:/xxx:8088/.....(因为我的是在上传文件的时候需要使用到)
解决办法:
1.页面请求的是自己写的一个servelet,加入response.setHeader("Access-Control-Allow-Origin", "*");
2.请求页面html,加入<meta http-equiv="Access-Control-Allow-Origin" content="*">
XMLHttpRequest cannot load http://localhost:8080/admin/admin/store. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '
http://xxx:8088' is therefore not allowed access.
网上查了查有两种解决方法
在测试的时候是别的地址来访问的,所以在获取session的时候,把地址改成 http:/xxx:8088/.....(因为我的是在上传文件的时候需要使用到)
解决办法:
1.页面请求的是自己写的一个servelet,加入response.setHeader("Access-Control-Allow-Origin", "*");
2.请求页面html,加入<meta http-equiv="Access-Control-Allow-Origin" content="*">
相关文章推荐
- 后端接收不到AngularJs中$http.post发送的数据原因分析及解决办法
- 我的手机管家(12) 网络助手 逻辑代码
- 【HTTPS双向加密认证】
- Android Mediaplayer error (1, -2147483648) Error (-38,0)解决方案(网络记载和本地加载两种情况)
- 我的手机管家(11) 网络助手 界面设计及适配器
- HTTP协议 与网络通信
- httphelper优化 cookie自动处理
- TCP&IP 实现
- 【译文】深度神经网络入门手册
- 关于网络的七层协议及相关信息记忆图
- node.js基础模块http、网页分析工具cherrio实现爬虫
- node.js基础模块http、网页分析工具cherrio实现爬虫
- 网络支付极其简单的体会
- 搞懂CSMA/CD,你就明白为什么以太网最小帧是64字节。
- 后端接收不到AngularJs中$http.post发送的数据原因分析及解决办法
- VMware克隆虚拟机的网络配置问题
- android开源框架android-async-http使用
- TCP的三次握手(建立连接)和四次挥手(关闭连接)
- Http Post 的Base64加密字段与后台接收的不一样
- Android okHttp:Https之SSL - Hostname was not verified