How do you access the top level of the DOM from jQuery?

dom, iframe, javascript, jquery

Solution

From inside of a frame you can always get to the top level using `window.top`. You can check to see if you are in a frame using:

var iAmInAFrame = (window.top == window.self);

You should be able to use `window.top.document.whatever` (e.g. body, getElementById(), etc.) to manipulate the top level document provided that you share a domain.

Problem

Trying to figure this out... I'm trying to accessthe top level of the dom from inside an iframe. How possible is this?

Original source