XMLHttpRequest cannot load – Origin is not allowed by Access-Control-Allow-Origin.

简介: 报错:跨域  XMLHttpRequest cannot load http://localhost:8080/admin/admin/store. No 'Access-Control-Allow-Origin' header is present on the requested resource.

报错:跨域

 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="*">
 
相关文章
|
JSON 前端开发 API
【跨域报错解决方案】Access to XMLHttpRequest at ‘http://xxx.com/xxx‘ from origin ‘null‘ has been blocked by
【跨域报错解决方案】Access to XMLHttpRequest at ‘http://xxx.com/xxx‘ from origin ‘null‘ has been blocked by
1910 0
|
5月前
|
JavaScript 前端开发
has been blocked by CORS policy: The ‘Access-Control-Allow-Origin‘ header contains multiple values ‘
has been blocked by CORS policy: The ‘Access-Control-Allow-Origin‘ header contains multiple values ‘
56 0
|
9月前
解决 Blocked a frame with origin “xxx“ from accessing a cross-origin frame
解决 Blocked a frame with origin “xxx“ from accessing a cross-origin frame
1227 0
|
5月前
|
安全 JavaScript 前端开发
No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.
No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.
|
API
【已解决】No ‘Access-Control-Allow-Origin‘ header is present on the requested resource
No ‘Access-Control-Allow-Origin‘ header is present on the requested resource
278 0
【已解决】No ‘Access-Control-Allow-Origin‘ header is present on the requested resource
|
10月前
|
API
百度API调用JSONP解决跨越问题 been blocked by CORS policy: No ‘Access-Control-Allow-Origin‘ header
百度API调用JSONP解决跨越问题 been blocked by CORS policy: No ‘Access-Control-Allow-Origin‘ header
153 0
|
10月前
|
前端开发 JavaScript
ajax请求的重定向处理--Request header field x-requested-with is not allowed by Access-Control-Allow-Header
ajax请求的重定向处理--Request header field x-requested-with is not allowed by Access-Control-Allow-Header
322 0
|
JavaScript Java 应用服务中间件
Vue 跨域问题 的几种解决办法 (No ‘Access-Control-Allow-Origin‘ header is present on the requested resource)
Vue 跨域问题 的几种解决办法 (No ‘Access-Control-Allow-Origin‘ header is present on the requested resource)
1604 0
Vue 跨域问题 的几种解决办法 (No ‘Access-Control-Allow-Origin‘ header is present on the requested resource)
|
11月前
Uncaught DOMException: Blocked a frame with origin "http://localhost:8000" from accessing a cross-origin frame.
Uncaught DOMException: Blocked a frame with origin "http://localhost:8000" from accessing a cross-origin frame.
239 0
|
12月前
|
Web App开发 存储 安全
新版本Chrome同源策略、跨域问题处理No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.
新版本Chrome同源策略、跨域问题处理No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.
538 0