title: Synchronous cross domain javascript call, waiting for response - is it possible?
body: <p><strong>Disclaimer</strong><br>
  Firstly, a disclaimer: I am working within specific boundaries, so whilst it may seem I'm going about something the long way round, I am limited as to what I can do.  I <em>know</em> I should be doing this entirely differently, but I <em>cannot</em>.  If it's not possible to do what I'm trying to do here, then that's fine, I just need to know.</p>
  
  <hr>
  
  <p><strong>Background</strong><br>
  Basically, this boils down to a cross-domain javascript call.  However, I need to wait for the response before returning the method.</p>
  
  <p>Say I have a page - example1.com/host.html.  This contains a javascript method of 'ProvideValue()' which returns an int.  <em><strong>Edit</strong>: This method must be executed where it is found, since it may need to access other resources within that domain, and access global variables set for the current session.</em></p>
  
  <p><em>https://example1.com/host.html</em></p>
  
  <pre><code>function ProvideValue(){
   return 8;  // In reality, this will be a process that returns a value
  }
  </code></pre>
  
  <p>This host.html page contains an iframe pointing to example2.com/content.html (<strong>note the different domain</strong>).  This content.html page contains a method that needs to display the value from host.html in an alert.</p>
  
  <p><em>https://example2.com/content.html</em></p>
  
  <pre><code>function DisplayValue(){
   var hostValue = //[get value from ProvideValue() in host.html]
   alert(hostValue);
  }
  </code></pre>
  
  <p>That's it.</p>
  
  <p><strong>Limitations</strong><br>
  I can run any javascript I like on the host.html, but nothing server-side.  On content.html I can run javascript and anything server-side.  I have no control over the example1.com domain, but full control over example2.com.</p>
  
  <p><strong>Question</strong><br>
  <strong>How can I retrieve the value from ProvideValue() on example1.com/host.html within the DisplayValue() method on example2.com/content.html?</strong></p>
  
  <hr>
  
  <p><strong>Previous Attempts</strong><br>
  Now, I've tried many of the cross-domain techniques, but all of them (that I've found) use an asynchronous callback.  That won't work in this case, because I need to make the request to the host.html, and receive the value back, all within the scope of a single method on the content.html.</p>
  
  <p>The only solution I got working involved relying on asynchronous cross-domain scripting (using easyXDM), and a server-side list of requests/responses in example2.com.  The DisplayValue() method made the request to host.html, then immediately made a synchronous post to the server.  The server would then wait until it got notified of the response from the cross-domain callback.  Whilst waiting, the callback would make another call to the server to store the response.  It worked fine in FireFox and IE, but Chrome wouldn't execute the callback until DisplayValue() completed.  If there is no way to address my initial question, and this option has promise, then I will pose this as a new question, but I don't want to clutter this question with multiple topics.</p>