<p>Here's my problem - I'd like to communicate between two websites and I'm looking for a clean solution. The current solution uses Javascript but there are nasty workarounds because of (understandable) cross-site scripting restrictions.</p>

<p>At the moment, <strong>website A</strong> opens a modal window containing <strong>website B</strong> using a <a href="http://jquery.com/" rel="noreferrer">jQuery</a> plug-in called <a href="http://dev.iceburg.net/jquery/jqModal/" rel="noreferrer">jqModal</a>. <strong>Website B</strong> does some work and returns some results to <strong>website A</strong>. To return that information we have to work around cross-site scripting restrictions - <strong>website B</strong> creates an iframe that refers to a page on <strong>website A</strong> and includes *fragment identifiers" containing the information to be returned. The iframe is polled by <strong>website A</strong> to detect the returned information. It's a <a href="http://tagneto.blogspot.com/2006/06/cross-domain-frame-communication-with.html" rel="noreferrer">common technique</a> but it's hacky.</p>

<p>There are variations such as <a href="http://www.julienlecomte.net/blog/2007/11/31/" rel="noreferrer">CrossSite</a> and I could perhaps use an HTTP POST from <strong>website B</strong> to <strong>website A</strong> but I'm trying to avoid page refreshes.</p>

<p>Does anyone have any alternatives?</p>

<p>EDIT: I'd like to avoid having to save state on <strong>website B</strong>.</p>

[{'answer_id': 33120, 'author': 'Pat', 'author_id': 238, 'author_profile': 'https://Stackoverflow.com/users/238', 'pm_score': 2, 'selected': False, 'text': '<p>With jQuery newer than 1.2 you can use <a href="http://remysharp.com/2007/10/08/what-is-jsonp/" rel="nofollow noreferrer">JSONP</a></p>\n'}, {'answer_id': 33123, 'author': 'TheSmurf', 'author_id': 1975282, 'author_profile': 'https://Stackoverflow.com/users/1975282', 'pm_score': 4, 'selected': True, 'text': "<p>My best suggestion would be to create a webservice on each site that the other could call with the information that needs to get passed. If security is necessary, it's easy to add an SSL-like authentication scheme (or actual SSL even, if you like) to this system to ensure that only the two servers are able to talk to their respective web services.</p>\n\n<p>This would let you avoid the hackiness that's inherent in any scheme that involves one site opening windows on the other.</p>\n"}, {'answer_id': 33444, 'author': 'Robin Minto', 'author_id': 1456, 'author_profile': 'https://Stackoverflow.com/users/1456', 'pm_score': 0, 'selected': False, 'text': "<p>@jmein - you've described how to create a modal popup (which is exactly what jqModal does) however you've missed that the content of the modal window is served from another domain. The two domains involved belong to two separate companies so can't be combined in the way you describe.</p>\n"}, {'answer_id': 33593, 'author': 'Vitor Silva', 'author_id': 1842864, 'author_profile': 'https://Stackoverflow.com/users/1842864', 'pm_score': 0, 'selected': False, 'text': '<p>i believe @pat was refering to this</p>\n\n<p>"As of jQuery 1.2, you can load JSON data located on another domain if you specify a JSONP callback, "\n<a href="http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback" rel="nofollow noreferrer">http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback</a></p>\n'}]
['https://Stackoverflow.com/questions/33104', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1456/']