Quote:
Originally Posted by Philip M
I can't tell you that because I don't know anything about CORS. Ask rndme.
As I understand it the CORS standard works by adding new HTTP headers that allow servers to serve resources to permitted origin domains.
But Javascript still cannot access those resources due to the SOP.
|
it's pretty straight-forward.
run this in firebug or devtool right now from here:
Code:
// normal 'ajax' function circa 2007:
function aGet(turl, callback) {
var XHRt = new XMLHttpRequest();
XHRt.onreadystatechange = function () {
if (XHRt.readyState == 4 && XHRt.status == 200) {
callback(XHRt.responseText, XHRt);
}
};
XHRt.open("GET", turl, true);
XHRt.send("");
return XHRt;
} //end aGet()
// example async call to 3rd party domain:
aGet(
"http://cdn.atlas.illinois.edu/css/?file=http://www.it.illinois.edu/styles/screen.css" ,
function(data){
alert( data.toUpperCase() );
}
);
it just works, no big whoop. you should see uppercase CSS when it's run.