Chat with us, powered by LiveChat
Importance of IFRAMEs

Importance of IFRAMEs

Iframes, or inline frames, allow you to load html files into an existing document. Frames are inline frames that are sometimes referred to as floating frames. One of the main advantages of the iframe tag is that it can be used to load external html or xhtml pages into the current document without distrubing the original page.

This iframe tag was not much popular when introduced because it was not supported by all the major browsers. But now Internet Explorer 4+, Netscape 6+, Firefox, Mozilla, Opera and other modern browsers all support iframes.

A basic iframe tag is :

<iframe></iframe>

However iframe supports a number of attributes like :

src, name, width, height, align, frameborder, scrolling

New html documents can be loaded into the iframe without disrupting the rest of the document. CSS and JavaScript can be used to manipulate properties of the iframe, such as its position and size. JavaScript can also be used to communicate between the document containing the iframe and the document loaded inside it.
So, dynamically the iframe contents can be replaced.

Also the iframes can be kept hidden. the hidden iframes can execute the code and then can send the results to the main document containing it using javascript. Thus, hidden iframes can be used as an alternative ti AJAX. Now-a-days many developers find it easy to use iframes for remote scripting. Remote Scripting is the process by which a client-side application running in the browser and a server-side application can exchange data without reloading the page.

Sharing

1 Comments

  1. Although iframes can be useful, with the growth in browsing websites on mobile phones, you often have to be careful in what you display in them and possibly offer an alternative version.

Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.