Page and Iframe communication with postMessages

17 בNovember 2013

  I was interviewed in a company that deals with advertizing. They asked me a question I didn’t get right, seeking for a way to determine whether a commercial, located in an <iframe>, is on thevisible screen or not. So, what do you do after you don’t get the right answer to the question? Go and find it. So I did. In HTML5, on of its API is a method named postMessage. This methodenables window objects (such as iframes) to communicate with one another. With this API the solution is quite simple: When loaded ,the hosted frame can send...
one comment