Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are IFrames (HTML) obsolete? [closed]

Getting contradictory messages about that, hope they're not. I cannot imagine support for it would stop, since a gazillion sites use them.

Some additional questions about that:

  1. Why should they phase out this tag?
  2. Any alternative for it?
like image 499
Peter Avatar asked Apr 16 '09 11:04

Peter


People also ask

Are iFrames still used in HTML?

The iframe element is supported by all modern desktop and mobile browsers. However, some browsers don't yet respond consistently to the three new HTML5 attributes for this element.

Are iFrames deprecated in HTML5?

First, the frame and frameset elements are not deprecated in HTML5, they're obsolete (i.e., they've been removed entirely).

Why iframe is not recommended?

If you create an iframe, your site becomes vulnerable to cross-site attacks. You may get a submittable malicious web form, phishing your users' personal data. A malicious user can run a plug-in. A malicious user can change the source site URL.


4 Answers

Support for <iframe> is still there in HTML 5, so I don't think this will change in the near future.

To answer your other questions:

  1. <iframe>s (as frames in general) are most of the time not user-friendly:
    • They don't allow easy access of the content in the frame via an URL (without losing the content outside of the frame at least).
    • Most "technophobe" users are irritated by frames.
    • As far as I know they are slower to render for browsers
  2. Alternatives include dynamic page generation (SSI, PHP, Rails and so on) and using JavaScript / AJAX to change contents of e.g. a <div>

To be clear: I'm talking about <iframe> as an interface element. Not a hidden element for loading other stuff like e.g. Google Mail does.

like image 68
Koraktor Avatar answered Oct 17 '22 13:10

Koraktor


In my opinion the W3C jumped the gun in dumping iframes from the Strict HTML and XHTML doctypes. In theory you would use the <object> element to add foreign objects to your document, but browser differences and limitations have made this a nonstarter for many developers. With the much-more-pragmatic HTML 5 (which is still a draft), iframes are back and even have two new attributes: seamless, and the intriguing sandbox.

like image 44
David Kolar Avatar answered Oct 17 '22 15:10

David Kolar


IFrames are not obsolete, but the reasons for using them are rare.

  • Using IFrames to serve your own content creates a "wall" around accessing the content in that area.
  • For crawlers like Google, It's not immediately clear that cotent in an iframe will be ranked as highly as if the content were simply part of the page. For many, this is reason enough not to use it.
  • It makes the DOM for the IFrame less accessible by tools like jQuery, prototype etc..

Reasons for using iframes:

  • It's great for walling off other people's stuff from other domains but it doesn't integrate smoothly. (stylesheets, javascript etc...)
  • Integrating multimedia can sometimes be done easier via an iframe as opposed to using the embed tag.
  • Really, really specialized cases like gmail's case where they are using it for sounds and history management.

I would also answer that there is no need for the removal of iframes, it's a needed tag and will be around for a while.

like image 22
cgp Avatar answered Oct 17 '22 15:10

cgp


Iframes are obsolete for page layout. Never use them instead of good CSS layout, even table-based layout is better.

Good reasons for using iframes are:

  • ads: adwords for example uses this technique, it is good for encapsulating - ad css won't destroy your page.
  • hidden iframe: it can be used for hundreds usable things, like tracking, ajax-alternative, etc.
like image 29
Thinker Avatar answered Oct 17 '22 15:10

Thinker