IFrame

From Wikipedia, the free encyclopedia

IFrame (from inline frame) is an HTML element which makes it possible to embed another HTML document inside the main document.

The size of the IFrame is specified in the surrounding HTML page, so that the surrounding page can already be presented in the browser while the IFrame is still being loaded. The IFrame behaves much like an inline image and the user can scroll it out of view. On the other hand, the IFrame window can contain its own scroll bar.

The embedded document can also be replaced by JavaScript without reloading the surrounding page, which makes many interactive applications possible, and IFrames are therefore commonly used by Ajax applications. The main alternative to using an IFrame in these situations is editing a document's DOM tree. Sometimes invisible IFrames are also used for asynchronous communication with the server, as an alternative to XMLHttpRequest. More recently, Mozilla Firefox and Microsoft Internet Explorer introduced content-editable and design mode, which enables users to edit the contents of the HTML contained in the IFrame. This feature has been used to develop rich text editors within an IFrame element.

While regular frames are typically used to logically subdivide the content of one website, IFrames are more commonly used to insert content (for instance an advertisement) from another website into the current page.

Example of an HTML page using an IFrame:

 <html>
  <head>
   <title>Inline Frames - demonstration</title>
  </head>
 
  <body>
   The below material comes from the website http://othersite.com:
   <iframe src="http://othersite.com"
    height="100" width="200" frameborder="0" scrolling="no">
    Alternative text for browsers that do not understand IFrames.
   </iframe>
  </body>
 </html>

[edit] External links

In other languages