黄聪: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>
....

 

你可能感兴趣的:(黄聪:Access-Control-Allow-Origin,JS跨域解决办法)