How to make XmlHttpRequest calls to another server in your domain
Since many questions about the AJAX RSS Reader were about making AJAX calls to another server in your domain, I maked small research to see what developers are using to bypass this issue.
- Abe Fettig gived few tips about this topic, he's mainly trying to use iframe as solution and document.domain. Repeated XmlHttpRequests also was a solution, but working only with IE and Safari and not with mozilla. Then he find a solution for Mozilla using a bridge iframe. A very good article that may answer many questions.
- CPAINT have a remote proxy feature cpaint.set_proxy_url() it assigns the URL to the CPAINT proxy script on your local server. When CPAINT is querying remote backends you must use the CPAINT proxy script to communicate with the remote backend. Modern browsers do not allow remote calls by JavaScript to prevent cross-site scripting attacks.
- I found more real world example using proxy technique to bypass this issue such wpLicense, Housing Maps which combine two remote services Google maps and craigslist ...
In the case of AJAX RSS reader I found it more easy to bypass this issue with making calls from local server and remote calls to the external server are made server-side. And this have many benefits sych :
- Keep control of your application %100
- Keep your visitors on site
- Caching : Request once from remote server and server for all requesting clients.
You may also try Abe techniques which I found very interesting to make calls to another server in your domain. Hope this will help.


Subscribe to AJAX Magazine's feed