黄聪:No 'Access-Control-Allow-Origin' header is present on the requested resource解决办法

.htaccess文件里面添加下面代码:

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

web.config文件设置:

<system.webServer>
  ...

    <httpProtocol>
        <customHeaders>
            <!-- Enable Cross Domain AJAX calls -->
            <remove name="Access-Control-Allow-Origin" />
            <add name="Access-Control-Allow-Origin" value="*" />
        </customHeaders>
    </httpProtocol>
</system.webServer>

 

你可能感兴趣的:(黄聪:No 'Access-Control-Allow-Origin' header is present on the requested resource解决办法)