Jump to content

Unable to read a XML file hosted on an external Web server


Webaluc
 Share

Recommended Posts

Hi all!

I need to read a XML file hosted on an external Web server, but I can't find the solution.

I made some tests here:
https://www.w3schools.com/xml/tryit.asp?filename=try_dom_xmlhttprequest_responsexml

First test: Replacing the "cd_catalog.xml" file name by the file full path:
https://www.w3schools.com/xml/cd_catalog.xml

Since the file is on the same server, everything is working fine.

Then, I tried the same file on another server and it doesn't work anymore:
https://www.webaluc.com/test/cd_catalog.xml

Any solution to this problem?

Thank you!

Link to comment
Share on other sites

For security reasons, Javascript is not able to read files on a different domain than the one that the page is on unless the owner of the domain sends an HTTP header allowing it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...