The document object is referenced as a property of the window object. If you reference a document without specifying which window it is in, you get the current document. Each of the following examples references a document to get its title:
document.title // Current document's title window.document.title // Same as above but explicitly references // current window myPlace.document.title // Title of document in the window myPlace
The myPlace reference in this example must be a window reference returned by the open method or the name of a frame in the current frameset hierarchy.
Regardless of whether the current window contains a frameset or an HTML document, the document object is fully exposed. For security reasons, some properties may not be accessible across domains. For example, the contents of a document are accessible only to pages that share the document's domain.