XMLHttpRequest cannot load file:///C:/Users/hamma/Desktop/rao.html

前端 未结 2 1600
无人及你
无人及你 2020-12-22 14:07






        
相关标签:
2条回答
  • 2020-12-22 15:05

    According to your console output:

    XMLHttpRequest cannot load file:///C:/Users/hamma/Desktop/rao.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

    That means that you are trying to run the file without a server i.e. file:///[...] and for security reasons you can't run AJAX requests like that.

    You need to setup a server and run the page through that to send requests.

    More Help

    If you are using Chrome, try this.

    Reading Material

    Same-Origin-Policy

    CORS

    0 讨论(0)
  • 2020-12-22 15:06

    Copy the file "rao.txt" into your project folder. Setup a localserver. Use wamp/xamp for setting localserver. Access the file like http://localhost/project_folder/path_to_rao.txt

    0 讨论(0)
提交回复
热议问题