chrome扩展开发,无法获取到外部json数据,提示不允许跨域访问,错误如下:
XMLHttpRequest cannot load http://blog.uoolo.com/XXXX. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'chrome-extension://mlahccmgaenmnbffnhnpafldiafkkbka' is therefore not allowed access.
一直认为是插件设置哪出了问题,其实是被访问的json数据端出了问题,没有设置允许跨域访问。
context.Response.AddHeader("Access-Control-Allow-Origin", "*");