다른웹사이트 설명 : https://code.i-harness.com/ko-kr/q/1a74f76


                           http://goni9071.tistory.com/entry/%ED%81%AC%EB%A1%AC-%EB%A1%9C%EC%BB%AC%EC%97%90%EC%84%9C-ajax-%ED%85%8C%EC%8A%A4%ED%8A%B8%ED%95%98%EA%B8%B0

                         

주소 : http://ahmed.amayem.com/solution-to-chrome-cross-origin-requests-are-only-supported-for-protocol-schemes-http-data-chrome-chrome-extension-https-chrome-extension-resource/


결론 : html 파일을 서버에 업로드 해야한다..


Solution to Chrome Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

If you are running a page directly from Chrome (you just double clicked on an html file) and you’re javascript is trying to request some data you will hit an error that looks something like the following:

Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

You can see the error in the console of your browser. To view the console check How to Open/Activate Web Developer Tools on Chrome, Firefox and Safari Browsers

The Reason

You are not opening the page through a server, like Apache or nginx, so when the browser tries to obtain the resource it thinks it is from a separate domain, which is not allowed.

The Solution

Run a Server on your Machine

Open your page through a web server like Apache, nginx, node etc.

Use a Different Browser

I did not find this error when directly opening the page using Firefox and Safari.

Contributions

  1. Krill Fuchs‘s answer to this Stackoverflow Question


+ Recent posts