window.parent and window.top are suddenly equal to window.self

239 Views Asked by At

I have a web app (B) which is hosted in another application (A) using an Iframe. My web application can without problems post messages (parent.postMessage(“my message", “*”)) to the parent, B.

My app has a link which points to an external web application (C). The link contains a redirectUrl which application C will call (POST) when it is done. The url points to an action in my application. The action ends up by ensuring that the current location is the same as before the user clicked the link:

    …
    var response = Request.CreateResponse(HttpStatusCode.Found);
    response.Headers.Location = new Uri(currentExecutionUrl);
    return response;

Now, once the user returns to my application from application C, it is no longer possible to post messages from my application the parent, A. When debugging the client, I can see the reason for this: window.self, window.parent and window.top are all identical and equal to my application’s window/document.

Notice that this only happens with iPhone / webkit. With android devices and desktop browsers it works as it should, i.e. the parent and top windows properties point to A as expected.

Any help is appreciated!

0

There are 0 best solutions below