Jslfl【软件开发技术笔记】

解决chrome不支持ajax本地html

在做静态效果时,经常要ajax请求本地html,chrome中运行会报错误:XMLHttpRequest cannot load file:///xxx/xxx.html. Origin null is not allowed by Access-Control-Allow-Origin.
解决办法,给chrome加上启动参数:–allow-file-access-from-files,重启浏览器即可。

,

Comments are currently closed.