關於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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章