Iframe Cross domain communication - resizing - cross browser?

When the main Window wants to send a message to the child iframe -

It sets the child iframe url to its current url + hash (which represents the data).

But how does an iframe get new data?

We have 4 options: (I'm not talking about the new api eg postMessaage api and XDM libraries)

  • The child will poll the new hash (setTimeout)

  • In the main window, you can resize the iframe (iframe must register onResize )

  • OnHashChange event can be used in iframe

  • Destroying / creating an Iframe proxy that uses "onload" to send msg (javascript function!) To "SameDomainIframe" via parent.frames['samedonain'].sendData(...)

Here is my question: (regarding option # 2 (resize)):

According to this article:

In Firefox, Opera, Google Chrome, and Safari, the onresize event fires only when the browser window is resized. In Internet Explorer, the onresize event is fired when the browser size of the window or item.

Question:

Is there any cross-browser solution for this thing?

I do not need a situation where the user resizes the browser, and the iframe will re-read the data!

I want the data to be read only when I send a message in an iframe and manually resize it

+5
javascript jquery cross-browser cross-domain iframe
Oct 05 '13 at 7:51
source share
1 answer

You can use porthole, which is the proxy for the cross-browser script for the iframe, but you will need to have a small proxy file on the receiving side of another iframe. Then you can transfer information and events from one iframe to another in browsers and domains

http://ternarylabs.imtqy.com/porthole/

+2
Oct 13 '13 at 4:32
source share



All Articles