Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow My(!) sites to communicate with Iframe?

I have ownership on A.com ( I wish...)

I also own B.com

is there any HTML tag / Token / code that can Allow B.com to do : top.myFunc()

 ________________
| A.com          |
|   __________   |
|   | B.com   |  |
|   |_________|  |
|________________|

p.s. : I've seen many question about this topic but none regarding a person owns 2 domains and want to allow this.

like image 722
Royi Namir Avatar asked Aug 13 '12 14:08

Royi Namir


People also ask

Can you communicate with iframe?

All you have to do is first dispatch an event from the iframe to the parent that notifies the parent that the iframe is loaded (essentially a "ready message"). The parent will be listening for messages and if it receives the "ready message" event, it can then reply to the iframe with whatever message you want to send.

Will iframe work if JavaScript is disabled?

If a user has javascript disabled, iframes will work. An iframe tag has attributes “height” and “width,” which allows the designer great latitude with dimensions and format like 300×250 , 728×90 depending on the Ad size. Iframe tag can appear anywhere on the page and several iframes can be added if wished to.

How do I get around the same origin problem with iframe?

A webpage inside an iframe/frame is not allowed to modify or access the DOM of its parent or top page and vice-versa if both pages don't belong to same origin. A frame or child page can bypass this restriction by setting window. document. domain variable to the same domain name as the parent's domain name.


1 Answers

These articles may help you

http://davidwalsh.name/window-iframe
http://ternarylabs.com/2011/03/27/secure-cross-domain-iframe-communication/

like image 153
Peter Avatar answered Sep 28 '22 09:09

Peter