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

Dustin Machi dmachi at dojotoolkit.org
Tue Jun 22 13:34:32 EDT 2010


http://www.sitepen.com/blog/2008/07/31/cross-site-xhr-plugin-registry/

This allows the use of standard xhr looking calls, but if a cross domain request is made and native browser methods for making that request aren't available, it will use the provided plugin.   I believe that older versions of dojo also contained an iframe proxy like what you were implementing, but i'm not sure that is in the current version of dojo.  You could download an older version to see how that works to figure out the browser issue you are having with your implementation.

Dustin


On Jun 22, 2010, at 1:28 PM, Victor Danilchenko wrote:

> On 6/22/10 1:25 PM, Dustin Machi wrote:
>> This will work for you I believe. http://www.sitepen.com/blog/2008/07/22/windowname-transport/
> 
> 	This looks like it might very well do the trick for the 
> neither-fish-nor-fowl browser like IE7, which no longer supports URL 
> fragments for communication, but still doesn't support HTML5. I will 
> give it a spin, thanks.
> 
>> http://www.sitepen.com/blog/2008/07/22/windowname-transport/
>> 
>> On Jun 22, 2010, at 1:22 PM, Victor Danilchenko wrote:
>> 
>>> 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
>>> _______________________________________________
>>> 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
>> 
>> _______________________________________________
>> 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
> 	Senior Software Engineer, AskOnline.net
> 	victor at askonline.net - 617-273-0119
> _______________________________________________
> 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



More information about the Dojo-interest mailing list