views:

87

answers:

2

I have IFrame with a button in it, and it's onclick is:

new window.parent.UI.Image('xyz').addToCart();

In Firefox, I don't have any problems with this code. In IE, however, I get a "permission denied" error.

Is there a different way I should be accessing the JavaScript in the parent window?

A: 

I removed "window" and simply reference "parent" alone, and this fixes it.

JamesBrownIsDead
A: 

"window.parent" and "parent" should be references to the same object. All global (non-locally scoped) references are resolved to the "window" object.

Are the IFrame and the parent window on different domains? If so, I would expect this to fail with either reference, due to cross-site scripting rules.

Zach