Question:

How to read XML from external domain using Javascript?

by  |  earlier

0 LIKES UnLike

example: read data from http://www.blah.com/reader.html

 Tags:

   Report

4 ANSWERS


  1. This is a browser security issue related to domains of origin. You can't read XML from a domain other than that from which your page originated. The usual workaround is to proxy the request on the server in your domain. The steps are:

    - your page passes its request to your proxy (Java, PHP, etc.)

    - your proxy forwards the request to the real service (other domain)

    - your proxy receives the response

    - your proxy forwards the response back to your page

    This "fools" the browser, since it only sees the proxy, and both your page and proxy have the same domain of origin.


  2. Check www.watchat.tv: I have written an RSS reader there (Php).

    It picks up XML files from OTHER domains, decode them and then send them to my domain.

    You can also check it at www.web2coders.com/rss


  3. You can't use JavaScript cross-domain. It's a security issue.

    If you have access to server-side scripting (like PHP, for example), you can attempt to do a file-read of the remote file, and process it locally... which, however, depending on your host may have been disabled, as it lends itself for abuse.

  4. Try these two links.

Question Stats

Latest activity: earlier.
This question has 4 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.