views:

99

answers:

1

I have a typical setup for cross domain.

site1.company.com

site2.company.com

Main application is running off of site1.company.com. Trying to get communication working between the a parent frame from site1 and child frame from site2

Both site 1 and site 2 are setting document.domain='company.com';

The communication works fine both ways, However the parent frame from site1 was no longer able to communicate with the rest of the site1 application due to the same origin policy. I added the same document.domain property to every web page in site1.

The issue I am now facing is all of our 20 some HTC files are no longer functioning. I attempted to set the document.domain in the script tag on the HTC's but this threw an access denied message.

Trying to use the HTC's without the document.domain results in the same origin policy failing and HTC javascript calls are throwing access denied.

Is there something special I have to do to enable document.domain in an HTC file? Can this even be done?

+1  A: 

Take a look at http://easyxdm.net/, it will enable you to embed frames that you can communicate freely and securely with across the domain boundary.

It will probably be easier than mucking about with document.domain (causes all sorts of issues).

This will most likely not work between HTML and HTC's, but it will between pages on the separate domains.

Sean Kinsey
Tried to implement this, mainly using the socket connection, However this seemed to be very sensitive to timing, could not get it to pass messages reliably.
Knife-Action-Jesus
Then you must be using it wrong - the transport stack guarantees delivery. Did you perhaps create the easyXDM objects *before* the DOM was fully loaded? Also, were there any errors reported?
Sean Kinsey
No errors were thrown, it was like the connection was just never established, I see the onReady code fire off but nothing is ever received on the other end. I think it may have something to do with the framework in our application. All the windows in our application are handled by an HTC, I think this is causing the issue.
Knife-Action-Jesus
Sounds like an awful application :) Does it work in anything other than IE? ;)
Sean Kinsey
I'm guessing that the NixTransport doesn't work in htc's, could you try setting the local: and remoteHelper attribute, together with a protocol:"2" ? This should force the transport over on the NameTransport.
Sean Kinsey
Doesn't work in anything other than IE. Other than the use of the HTC's it isnt a bad app. I was able to get this to work by isolating the sender receiver pages from the htc's caused some other issues with what I wanted to do with it but was able to overcome that as well. Wasn't easy but in the end this did the job.
Knife-Action-Jesus
What didn't work in anything other than IE?
Sean Kinsey