Access-Control-Allow-Origin,JS跨域解决办法

简介:

.htaccess添加下面代码:

<IfModule mod_headers.c>    
Header add Access-Control-Allow-Origin "*" 
</IfModule>

 

web.config设置下面代码:

 

复制代码
....
<system.webServer>
      <httpProtocol>
        <customHeaders>
          <add name="Access-Control-Allow-Origin" value="*" />
        </customHeaders>
      </httpProtocol>
</system.webServer>
....


本文转自黄聪博客园博客,原文链接:http://www.cnblogs.com/huangcong/p/5403866.html,如需转载请自行联系原作者
相关文章
|
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
1846 0
|
开发工具 数据安全/隐私保护 git
Git报错:remote: HTTP Basic: Access denied的解决方法
Git报错:remote: HTTP Basic: Access denied的解决方法
1167 0
Git报错:remote: HTTP Basic: Access denied的解决方法
|
8月前
|
JavaScript 前端开发 安全
vue中解决ajax跨域问题(no “access-control-allow-origin”)
产生原因 跨域是是因为浏览器的同源策略限制,是浏览器的一种安全机制,服务端之间是不存在跨域的。 所谓同源指的是两个页面具有相同的协议、主机和端口,三者有任一不相同即会产生跨域。
113 0
|
9月前
|
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
147 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)
1555 0
Vue 跨域问题 的几种解决办法 (No ‘Access-Control-Allow-Origin‘ header is present on the requested resource)
|
11月前
|
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.
478 0
|
缓存 安全 搜索推荐
Cors跨域(三):Access-Control-Allow-Origin多域名?
Cors跨域(三):Access-Control-Allow-Origin多域名?
Cors跨域(三):Access-Control-Allow-Origin多域名?
|
开发工具 数据安全/隐私保护 git
git 报错:remote: HTTP Basic: Access denied
git 报错:remote: HTTP Basic: Access denied
110 0
git 报错:remote: HTTP Basic: Access denied
(原因:不允许有多个 ‘Access-Control-Allow-Origin‘ CORS 头)
(原因:不允许有多个 ‘Access-Control-Allow-Origin‘ CORS 头)
260 0
|
前端开发 数据可视化 Java
报错:跨域问题解决 No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.
报错:跨域问题解决 No ‘Access-Control-Allow-Origin‘ header is present on the requested resource.
1081 0