XMLHttpRequest cannot load file
今天小指在Ubuntu Chrome进行ajax测试没反应,F12 ->Console发现是Chrome不支持file协议
解决办法:
sudo vim /usr/share/applications/google-chrome.desktop
在所有 Exec=/usr/bin/google-chrome-stable 这一行后添加参数 --allow-file-access-from-files 保存重启Chrome即可
临时办法:
命令行输入:google-chrome-stable --allow-file-access-from-files打开
实际上测试网页,最好还是使用HTTP,个人建议搭建本地WEB服务器,一切问题都不用纠结啦!
sudo apt-get install tasksel sudo tasksel install lamp-server
安装完成,配置自行百度吧
点赞1
支持一下