When the main Window
wants to send message to a child Iframe -
It sets the child's Iframe url to its current url+ hash (which represents data).
But how would the iframe get's the new data ?
We have 4 options : ( i'm not talking about new api's eg postMessaage
nor XDM libraries)
The child is polling the new hash ( setTimeout)
The main window can resize the iframe (the iframe must register onResize
)
The OnHashChange Event can be used on the iframe
Destroying/creating proxy Iframe which uses "onload" to send msg (javascript function !) to its "SameDomainIframe" via parent.frames['samedonain'].sendData(...)
Here comes my question : (regarding option#2 ( resize event) ):
According to this article :
In Firefox, Opera, Google Chrome and Safari, the onresize event is fired only when the size of the browser window is changed. In Internet Explorer, the onresize event is fired when the size of the browser window or an element is changed.
Question :
Is there any cross browser solution for this resize thing ?
I don't want a situation where a user resize the browser , and the iframe will re-read the data !
I want the data to be read Only when I send a message to the iframe and manually resize it
You can use porthole which is a cross browser proxy script for iframes you will need to be able to host a small proxy file on the receiving end of the other iframe though. You can then pass information and events from one iframe to another across browsers and domains
http://ternarylabs.github.io/porthole/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With