Recently, a client raised a particular issue: they wish to publish interstitial content on their home page using the Ad Serving module within our SmartProfile suite. They are encountering difficulty hiding the background layer (overlay) by clicking on their content.
To put it simply, an (obvious) security constraint at the browser level prevents two windows (frames or iframes) from communicating with each other if their domains are not the same.
Let's take a concrete example: A main window (blue background in the following diagram) displays a document from the www.aaa.com domain.
This document contains:
- A definition of a JavaScript function, testA() that displays a message
- an iframe (child window, red background in the diagram below) whose document source code is available from a domain www.bbb.com. This document simply calls the parent window's function (blue background; «parent.testA();»)
In this case, the call is blocked by the browser and the testA() function will not be executed.

Having control over both domains, we do, however, have the ability to bypass this limitation very easily. Within the subframe (red background), we add a frame (green background in the diagram below) which will load a document contained on the first domain («www.aaa.com» for our example) and which will be responsible for calling the javascript function testA(). In this way, we can simulate an interaction between 2 frames based on different domains.

Respond to this article by leaving a comment, share it with your friends and acquaintances, and sign up for our RSS feed to be informed as soon as new articles are published.


