views:

20

answers:

1

I have two different applications loaded into different frames. I need them to communicate I know that javascript security model does not allow frames loaded from different domains to communicate but since I control both applications maybe there is a way to allow frames loaded from specific another domain to communicate with this frame

If it is not possible what's the hack around? Apps are different and I need to load them at different domains (or at least different ports) I can not run them as one app

A: 

If they share top-level domain (e.g. foo.example.com and bar.example.com), then you can set document.domain = 'example.com'; to relax same-origin restriction.

If you support only HTML5 browsers, then there's postMessage() exactly for cross-domain communication.

Other options are JSONP (fancy name for a cross-domain <script> tag) and proxying of XmlHttpRequest via the server on each domain.

porneL
thank yousound like
postMessage is the best solution for me