Bear with me, I've been working on this solidly for 2 weeks now, so I'll do my best to explain it.
In all of this, I am working within specific limitations that cannot be changed. It might seem odd, but there it is!
So, I have a HTML page at example1.com/host.html.
This page contains an iframe pointing to example2.com/contents.html.
It's this last bit I can't get my head around. All the solutions I can find just do 1-way communication. Sure, they can respond later via a callback, but the GetValueFromExample1 method has already finished by then, and I've got to return something.
Just so you know my last 2 weeks haven't been in vain, I've got a solution that works fine in FireFox and IE, but not Chrome. I've done that by making a list of requests in example2.com, and when GetValueFromExample1 runs, it adds the request to that list, calls example1.com (using a third-party cross domain library), then sits in a loop until the request is updated with the response in the list. When example1.com has received the request, it then makes a call back to example2.com with the response, which updates the list.
Has anyone got any suggestions, or am I barking up the wrong tree?
I'm happy to completely change how it's working, as I'm feeling this is getting very hacky now, but I can't seem to think of any other options.