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.