ajaxdinesh — 2009-05-21T01:20:36-04:00 — #1
- What is the difference between frame and iframe?
- Which one is best?
- Which situation we can use frame and iframe?
- These are deprecated tags?
mittineague — 2009-05-21T09:30:02-04:00 — #2
A frame is part of a frameset, an iframe is an inline frame element.
I think of a frameset as a kind of table layout, each frame being a part of a defined "grid", where iframes can be positioned using CSS
Best? It depends on what you need. I think frames became popular for static pages before backend "includes" became widely used. That is, a page might have header, nav links, footer, and content frames, where the content frame changed so every "page" had the same header, nav links, and footer, without the need to recode them for multiple pages. You could do the same kind of thing with iframes if you wanted to.
You can use frames if you use the frameset doctype, iframes anytime.
I don't know the why behind frameset being deprecated, but iframe is deprecated in favor of using the object tag instead. The problem is that although iframe is deprecated, it's still widely supported, and personally I find the object tag a bit more trouble to work with (though I use neither).
alexdawson — 2009-05-21T20:00:08-04:00 — #3
Well accessibility for one reason, the use of frames has been proven to make browsing the website on some devices as impossible, also having pages embedded inside pages... it also has a dark undertone of trying to cover up some potentially dangerous coding.
felgall — 2009-05-21T22:06:40-04:00 — #4
With frames you need one more HTML page than you have frames - one to go in each frame and one to define the frameset that contains the frames. To do the same layout using iframes requires one less HTML page since the page containing the iframes can also contain the fixed part of what you want displayed.
Basically anything that can be done with frames can also be done using iframes with using fewer files to define what to display.
cooper_semantics — 2009-05-27T20:19:34-04:00 — #5
melissapbr — 2009-06-02T18:05:47-04:00 — #6
I personally wouldn't use frames anymore, it just seems outdated. Although it's easy to implement for a case where you have to load a document in a window that uses up the entire area as defined for that frame in a frameset. It can get tricky to get an iframe to use up the entire window height, because you have to dynamically determine what that height is at any given moment.
With iframes, you can easily assign a fixed width/height if you want to just include the external document in a well-defined smaller area of the page.
Iframes come in handy if you want to absolutely position different documents on top of each other and reveal them via tabs as needed for example to allow for quick switching between documents without reloading or relying on AJAX.
Iframes are still more consistently supported than the object element and are not necessarily deprecated (only in strict DTD, but not transitional). Also, framesets are not deprecated either, they have their own DTD.
linkmanager227 — 2009-06-08T02:34:54-04:00 — #7
As per i know an inline frame is just a frame within a single page usually containing another page - it can exist without having a frame set defined and Frames are a bunch of 'boxes' put together to make one site with many pages....