Using IO's alternative transport method for requesting external URIs
In this recipe, we will look at a method for retrieving data from an external domain. Due to security restrictions, it is not possible to make requests to an external URI with JavaScript's XMLHttpRequest. YUI avoids this restriction by including a built-in alternative transport mechanism based on Adobe Flash. In this way, any trusted domain with a valid cross-domain policy file may be used as a source of data.
Getting ready
First, we need to ensure that the remote domain is configured to accept incoming client requests. This is done by installing a cross-domain policy file crossdomain.xml
on the remote domain. This cross-domain policy file specifies which domains are authorized to make requests via Adobe Flash (.swf)
applications.
The following example configures the domain remote.example.com
to accept incoming HTTP requests from any host on example.com
.
Contents of the http://remote.example.com/crossdomain.xml
file are as...