关于Chrome浏览器使用ajax访问本地文件报 Cross origin requests are only supported for HTTP

先浏览了http://blog.csdn.net/rywaqpf/article/details/44836965,然后又奔到了https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local/23758738#23758738,受其中的高票答案启发:

解决这个问题的方式有好几种。除了CMD的allow-file-access-from-files(自己还未试过),还可以在自己的PC上装一个服务器(刚好,前期装了LAMP),然后把文件(相关的html、js、css等等)拷贝过去,然后以类似http://localhost/XXX.html的形式访问,就可以了。


https://stackoverflow.com/questions/10752055/cross-origin-requests-are-only-supported-for-http-error-when-loading-a-local/23758738#23758738    中的高票答案(建议直接点看链接):

My crystal ball says that you are loading the model using either file:// or C:/, which stays true to the error message as they are not  http://

So you can either install a webserver in your local PC or upload the model somewhere else and use jsonp and change the url to http://example.com/path/to/model

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值