Why must Javascript from http://a.example.com talking to http://b.example.com be full of hate?
August 15, 2008 11:04 AM Subscribe
How can I pass data via Javascript from http://a.example.com to http://b.example.com without using http://example.com?
I've got a web service call fetching data on http://a.example.com and it needs to pass the response to http://b.example.com via Javascript.
I tried using the techniques described here, but I haven't had any luck getting it to work. It basic setup is an html page on http://b.example.com has an iframe that loads a simple page from http://a.example.com. The JS on http://a.example.com looks something like this:
function OnGetDataComplete(results)
{
var oldDomain = document.domain;
document.domain = 'example.com';
window.parent.ProcessData(results);
document.domain = oldDomain;
}
I think this is because this example is going from http://www.example.com to http://example.com, not to another subdomain. All the Googling I have done seems to address only this problem, or at the very least requires something on http://example.com to make communication between http://a.example.com and http://b.example.com work (this isn't really an option for me).
Anyone have any insight into how make this work?
I've got a web service call fetching data on http://a.example.com and it needs to pass the response to http://b.example.com via Javascript.
I tried using the techniques described here, but I haven't had any luck getting it to work. It basic setup is an html page on http://b.example.com has an iframe that loads a simple page from http://a.example.com. The JS on http://a.example.com looks something like this:
function OnGetDataComplete(results)
{
var oldDomain = document.domain;
document.domain = 'example.com';
window.parent.ProcessData(results);
document.domain = oldDomain;
}
I think this is because this example is going from http://www.example.com to http://example.com, not to another subdomain. All the Googling I have done seems to address only this problem, or at the very least requires something on http://example.com to make communication between http://a.example.com and http://b.example.com work (this isn't really an option for me).
Anyone have any insight into how make this work?
This thread is closed to new comments.
posted by Nelsormensch at 11:15 AM on August 15, 2008