Cross-domain messaging via iFrame

Sep 22, 2006 by Andre
Julien Couvreur posts on capabilities provided by both Dojo and the Windows Live toolkit to enable cross-domain interaction via Javascript: http://blog.monstuff.com/archives/000304.html

Microsoft's example app to demonstrate the technique is here: http://dev.live.com/mashups/partystart/ . Dojo's documentation is here: http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book75

In both cases, the methodology involves a behind-the-scenes iFrame to do your dirty work of message passing between domains. Obviously there are other ways of accomplishing this (i.e., Flash integration and a server proxy). Still, there are clearly advantages to having a browser-only solution.

Comments

1

Girish Singh on May 03

As a rule of thumb you cannot directly access the javascript from one domain to the other. However you can pass messages and data across which can then accordingly trigger events in the javascript.

One way is to the use a proxy in between the two domains and relay an AJAX request to the other domain through the proxy. A detailed article on it is on http://www.mabaloo.com/Web-Development/Pear-HTTP-Request-A-Cross-Domain-AJAX-focused-tutorial.html

Another way which does not involve a proxy but uses Iframes is by using the URL hash.
http://www.mabaloo.com/Web-Development/Cross-Domain-Message-Passing-using-Iframe.html

Post a comment

 
This is so filters can reject the spam-bots. Thanks!