处理跨域方式

1,代理

  后台处理

2,JSONP

  只支持GET请求,不支持POST请求

3,XMLHttpRequest Level5(XHR2)html5提供

  IE10浏览器以上

  PHP添加:   

  header( " Access-Control-Allow-Origin: * " );
  header( " Access-Control-Allow-Methods: POST,GET " );
 ASP.NET在web.config中的system.webserver中添加以下代码,(已经过测试,来源于 http://www.it165.net/pro/html/201305/5825.html)
  
  <system.webserver>
    <httpprotocol>
      <customheaders>
        <add name="Access-Control-Allow-Origin" value="*">
        </add>
      </customheaders>
    </httpprotocol>
  </system.webserver>
posted @ 2015-10-10 20:37  小东Blog  阅读(180)  评论(0编辑  收藏  举报