I would like to make a webpage where the user browser would have to download data like with Ajax but without domain restrictions. I don't care about the technology. Flash, Java, whatever. Is it possible?
A:
Yes it's possible.
When fetching data with ajax, the domain doesn't matter because it's simply an independent http-request. It's as if you would be typing the url in a new browser tab, but in the case of ajax, your browser handles these requests automatically.
This is similar to what happens to images, scripts, css files, ...
(I use php5 and jquery for my apps)
zilverdistel
2010-05-30 09:25:30
I believe you are wrong since cross domain policy applies to http requests
2010-05-30 09:30:12
I tested this, and you are absolutely right, user353874. My bad ..
zilverdistel
2010-05-30 15:37:04
+1
A:
Assuming you don't have control of the other servers and access control is not an option, one common way is to have a proxy on your own server. Can be as simple as a PHP script
$handle = fopen($_GET['url'], "rb");
while ( !feof($handle) ) {
echo fread($handle, 8192);
}
fclose($handle);
that is used in proxy.php?url=http://example.com/data/
fashion.
Iggy Kay
2010-05-30 09:28:06
As halfdan noted, the restrictions are there for a reason. By using a proxy, the requests to the external server will be coming from your server, making it easy to block.
Iggy Kay
2010-05-30 09:30:38