tags:

views:

28

answers:

1

I see this referenced a lot: http://ajaxify.com/run/crossframe/

And I noticed now it's no longer working for the IFRAME (child) to change the parents hash.

I've been spending a few hours trying various things wondering why this isn't working anymore -- then I finally realized that the example I originally based it on was down too.

Can anybody confirm?

-

-

I need to use a cross domain iframe to take care of an order upload form that our shopping cart doesn't support, and I need the form to return an order ID to the parent, so that I can associate the data between the two servers.

Any recommendations or directions to head in would be appreciated.

I'm not looking for a shortcut or somebody to do my work. I've been reading all day... I just need a nudge in the right direction.

Thanks!

A: 

It is partly browser-specific. For instance, some browsers don't allow a nested child frame (iframe within an iframe) to change its parent's fragment. See this blog entry. But the basic functionality still works in recent browsers. This demo, which has an iframe change its parent, and vice versa (single level) works fine in Firefox 3.5.9 and Chrome 5.0.375.99.

The demo you gave also works both ways in that version of Firefox. It doesn't allow the child to change the parent in Chrome. The main difference seems to be that the working one uses parent.location, while the broken one uses parent.window.location.hash.

The best solution for recent browsers is postMessage. If necessary, you can also use a server proxy.

Matthew Flaschen
Hi Matthew, Thank you so much for the answer. This is my first stack question after many almost-stack questions. Indeed, the demo I linked was not working on Chrome. Thank you for the link to the working example. This is a lifesaver and I have it working on my site : )I will stick to the old method, and try to detect when communication has failed / take extra steps for those people.-Yuji
Yuji