XMLHttpRequest cannot load file. Cross origin requests are only supported for HTTP

后端 未结 7 858
太阳男子
太阳男子 2020-11-22 07:08

I am getting the following error:

XMLHttpRequest cannot load file:///C:/Users/richa.agiwal/Desktop/get/rm_Library/templates/template_viewSettings.html. Cross         


        
7条回答
  •  孤街浪徒
    2020-11-22 07:38

    This error is happening because you are just opening html documents directly from the browser. To fix this you will need to serve your code from a webserver and access it on localhost. If you have Apache setup, use it to serve your files. Some IDE's have built in web servers, like JetBrains IDE's, Eclipse...

    If you have Node.Js setup then you can use http-server. Just run npm install http-server -g and you will be able to use it in terminal like http-server C:\location\to\app. Kirill Fuchs

提交回复
热议问题