Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is iframe equivalent to window?

I'm trying to understand a hierarchical picture of window, document and iframe.

So, window is simply the browser's window and document is where the DOM exists. The document is loaded in window.

Is creating an iframe much like creating a dialog (window.openDialog()) (which is nothing but a window)?

Both have a content document and parent window.

like image 924
batman Avatar asked Jul 16 '13 20:07

batman


People also ask

Does an iframe have its own window?

An <iframe> tag hosts a separate embedded window, with its own separate document and window objects. We can access them using properties: iframe.

How do I know if my windows is an iframe?

In short, to check if a page is in an iframe, you need to compare the object's location with the window object's parent location. If they are equal, then the page is not in an iframe; otherwise, a page is in an iframe.

Can an iframe open a new window?

Yes you can open a new Window from iFrame........

Are iFrames still used?

iFrames are an HTML tag and have been around for absolutely ages having been introduced back in 1997. Despite their age, they are still commonly used and are supported by all modern browsers.


1 Answers

Here's a very good discussion from WHATWG, the founders of HTML5: 6 Loading Web pages -- HTML: The Living Standard - Edition for Web Developers

In summary, but lots more at the actual page:

A browsing context is an environment in which Document objects are presented to the user.

A tab or window in a Web browser typically contains a browsing context, as does an iframe.

and

Certain elements (for example, iframe elements) can instantiate further browsing contexts. These are called nested browsing contexts.


And, if you want to know more about WHATWG: FAQ - WHATWG Wiki

like image 101
leanne Avatar answered Oct 14 '22 02:10

leanne