If they both come from the same origin (ie the same domain), then each can access the other's variables as normal.

To access the parent's scope from the child you can use [window.parent and to access the child's scope from the parent you can use a couple of methods, such as [url=https://developer.mozilla.org/en/DOM/window.frames]window.frames](https://developer.mozilla.org/en/window.parent).

So, for instance, if you define a var myvar = 2 in the parent scope, you can access that in the iframe as window.parent.myvar.

If the page inside the iframe comes from a different domain to the parent page then it cannot access anything from the parent (with only a very small number of exceptions, such as being able to reload/redirect the page). This same is mostly true of the parent page accessing anything from the child frame as well.