[Dojo-interest] Dojo cross-domain communications (iframe)

Victor Danilchenko victor at askonline.net
Tue Jun 22 13:22:01 EDT 2010


On 6/22/10 10:07 AM, Stefano Gargiulo wrote:
> what do you need excactly?
> 1) cross-domain ajax requests?
> 2) operating with a real iframe document dom?
>
> for 1) see dojo.io.script and jsonp
> for 2) wait html5 and the allow-same-origin attribute in iframes.

	Unfortunately, I need #2 -- communication between frames with different 
origins. This is due to a single-domain license we have on one component 
of our product (the product is spread across multiple domains which 
share common server resources). We load this licensed component in an 
iframe, but for one particular feature, it has to communicate with the 
container page.

	I have already implemented a dual-prong solution (URL fragments or 
postMessage, depending on the capability test results), only to discover 
that my very, very favorite browser -- IE7 -- does not support either 
method. Ugh, how I hate it...

	I googled it, and found some information on IE7 policy settings 
pertaining to the cross-domain frame navigation. However, this doesn't 
help me -- with that flag enabled, I still can't access 
iframe.contentWindow.location -- and anyway, we can't expect our users 
to follow non-trivial instructions on managing IE security policy.

	The obvious solution would be to scrap the whole thing and use a common 
server endpoint for communicating between the frames, but that would be 
a rather more complicated solution to implement; and if there's one 
programmer's virtue I possess in abundance, it's laziness.

	Does anyone know of some IE7 hack for communicating between 
different-origin frames?

	Thanks in advance guys, you have been most helpful this far.

> Il 21/06/2010 22:41, Victor Danilchenko ha scritto:
>> 	Hi all,
>>
>> 	I am hoping someone here can help me with what should have been a
>> non-problem.
>>
>> 	Does Dojo have some facility to support cross-domain communication with
>> an iframe-wrapped page? I vaguely seem to recall reading about it
>> somewhere in the docs, about Dojo supporting communication via the hash
>> fragment, but now I don't seem to be able to find it.
>>
>> 	I have actually rolled my own (it's a really trivial problem, the
>> framed page has to send one string to the container page), and then I
>> realized that Firefox 3.5 is refusing to permit the container page to
>> read the iframe.contentWindow.location attribute (I get the "Permission
>> denied  to get property Location.hash from" error), even though that's
>> been readable forever. I know I have the basic functionality right
>> because the hash-fragment setting/polling works when the iframe is local.
>>
>> 	I am hoping Dojo has some workaround in place for that.
>>
>> 	Alternatively, perhaps I am doing something really obviously stupid,
>> and someone can set me on the right path? Or at least point to a better
>> place to ask?
>>
>> 	Thanks in advance.
>> 	
>>
>
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://docs.dojocampus.org
> Dojo-interest at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


-- 
	Victor Danilchenko


More information about the Dojo-interest mailing list