Open local html pages using http for testing

I encode webapp and get these errors with chrome:

XMLHttpRequest cannot load file:///C:\Users\Tordah\Desktop\foobar.xml. Cross origin requests are only supported for HTTP. 

&

Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 

I believe that I am getting this error because to the HTML: protocol file, and not to http: protocol, which creates compatibility problems with XMLHttpRequest (this is an assumption). I would like to know if there are ways to test my pages using the http protocol only with my local machine (because only later in this project will I have access to the server, and therefore the application will only work using http, but for now I would like to be able to verify it correctly).

Are there any workspaces that I could do on the local machine that could work with the three browsers IE, Firefox, and Chrome?

Thank.

+4
source share
2 answers

I assume that you did not install a local server ... I offer you XAMPP, best suited for such products ...

https://www.apachefriends.org/download.html

here is the url where you can download it. when you already installed it, you need to copy your work to the directory

C: / xampp / htdocs / (here you insert your work)

open your browser and write in url like this:

http://localhost:8080/(name of your work directory)/(what archive you want to see, better if it has index)
+6
source

You need to install a web server. You have a bunch of different options, but since you did not specify an operating system, I suggest XAMPP from https://www.apachefriends.org/download.html

Apache, MySQL, PHP Perl, Windows/Mac/Linux

+2

Source: https://habr.com/ru/post/1543879/


All Articles