PDA

View Full Version : [CLOSED] MessageBus thru iFrame via hosted Domain



VirtualArtists
Dec 15, 2013, 5:30 PM
hi : We have the MessageBus working well - IF - everything is hosted under one domain.
For Example : http://www.Child.com - works great - if all MessageBus code runs under this one domain.
--
We have error when, for example, there is a hosted service on a different domain:
For Example, below: Parent.com , hosts Child.com via iFrame:
http://www.Parent.com
-- http://www.Child.com

In example above, when the URL we see in address bar = http://www.Parent.com, then the MessageBus running on the Child.com code fails.
I hope this makes sense: Essentially, we need a way to use MessageBus, when the Domain URL (in the address bar) i.e. Domain of parent, is different than domain of Child in iFrame where MessageBus is running.

Vladimir
Dec 15, 2013, 5:49 PM
It is browser security restriction is called "same origin policy" (see http://en.wikipedia.org/wiki/Same-origin_policy)
You can try to add "Access-Control-Allow-Origin" header to the required appilcation (or for particular page only) to deactivate that security mode (not sure if it will work always)
Please see http://stackoverflow.com/a/18219077/1475939

Links which can be interesting for you
http://stackoverflow.com/questions/1378433/how-do-i-implement-cross-domain-url-access-from-an-iframe-using-javascript
http://stackoverflow.com/questions/4912670/how-to-use-javascript-to-access-cross-domain-iframe-content