67

HTML has had frames from early days, but they are deprecated in the latest version. Many browsers (I have tried with Internet Explorer) don't even display frames properly.

Why has this been done? What was the drawback in frames?

gunr2171
  • 16,104
  • 25
  • 61
  • 88
SonOfTheEARTh
  • 1,858
  • 5
  • 21
  • 23
  • "Initially" is false. But otherwise this stands. – Ignacio Vazquez-Abrams Nov 24 '10 at 04:42
  • 11
    Well, the problem is that they *exist*. :) – Alex Nov 24 '10 at 04:43
  • 3
    Frames still work. Javadocs still use frames and render reliably across all major browsers. Example here: http://download.oracle.com/javase/7/docs/api/ – Asaph Nov 24 '10 at 04:45
  • I actually use frames because I DON'T want the user to save an internal url. I'm sure there's probably another way to get that done these days but old habits die hard when you don't learn the new tricks. –  Jun 20 '13 at 21:01
  • [Frames have been deprecated](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/frame); see discussions [here](https://programmers.stackexchange.com/questions/144515/why-were-frames-deprecated-in-html5-but-not-iframes) and [here](https://stackoverflow.com/questions/10159741/frames-deprecated-in-html5-but-not-iframes). – WBT May 24 '16 at 19:01
  • 1
    Frames are very useful in some cases: http://reframe.deneskellner.com is a good example. I could have done it without frames of course - but it is so straightforward and effortless this way. I can't understand why deprecation is the answer when something goes out of fashion. – dkellner May 24 '17 at 20:24

3 Answers3

66

Jakob Nielsen wrote a 1996 column that criticized frames. Some key points:

  1. Frames prevent users from properly bookmarking pages. When a bookmarked frameset page is loaded, users' previous mouse clicks inside the frames do not matter. Only the outer URL is saved, and users have to navigate to where they were manually.

  2. Frames present challenges for printing web pages. Printing all the frames at once is not suited to the different dimensions of paper (and users can get only the first pageful that way). Users generally have to right-click the frame they want and choose the appropriate context menu option.

  3. Users coming from search engines may not have access to navigational elements if they are located in another frame — they are directed to only that frame the search engine found the text in.

While "framesets" (the most common type used on late 1990s/early 2000s web pages) are dying, the iframe (short for inline frame) remains alive and well. In fact, recently iframes have been found useful in today's "mashup" web applications, and extensions to the iframe are currently proposed in the HTML5 specification.

For example, Facebook, in its API for app developers, uses them to seamlessly integrate third-party apps with their own site while minimizing the security risk. (In this model, all third-party code remains on a separate domain, which is good for security reasons.)

PleaseStand
  • 31,641
  • 6
  • 68
  • 95
  • i did not understand the third point very well. does the point mean some thing like that users coming from search engines will open only the page that has the content and not the index page of the frame. hence will not have all links(because most links will be on the other parts of frame which is the usual practice). – SonOfTheEARTh Nov 24 '10 at 06:02
  • 2
    @SonOfTheEARTh: Yes, that's what I mean. – PleaseStand Nov 24 '10 at 12:16
  • 3
    1st point is really crucial, but, unfortunately, with all the template systems and JS allowing to change content of page on-the-fly, some pages are again impossible to bookmark... – Alissa Jul 08 '16 at 16:21
  • 1
    1996 was a great year. A lot happened since then. Today all the issues above can easily be solved without any pain. The reasons of 1996 are mostly invalid. Frames are one option to achieve something that you find almost everywhere around the web. A lot of pages, from Facebook to phpMyAdmin, look like frames, they're just implemented with a different markup. The only sickness of frames is not being able to write across frame borders; yup, that's one drawback but also a blessing in some cases. Otherwise, there are no real good reasons AGAINST frames. – dkellner May 24 '17 at 20:40
  • This is the most objectively-written summary of the history of frames I've ever seen. – Sean the Bean Aug 10 '17 at 18:00
  • 1
    While the information may be interesting, I don't think this answers the user's question. Most, if not all, of Nielsen's objections could also be applied to iframes. I think the question is more better answered here: https://softwareengineering.stackexchange.com/questions/144515/why-were-frames-deprecated-in-html5-but-not-iframes – Rick Paul Apr 05 '18 at 21:09
9

Frames are not deprecated in HTML. They are obsolete in HTML 5, and just discouraged before this version. This has been clearly mentioned in the specified links.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Pascal Qyy
  • 4,442
  • 4
  • 31
  • 46
  • 8
    And now we're doing the exact same things with JavaScript. Brilliant. – Ignacio Vazquez-Abrams Nov 24 '10 at 05:09
  • they are deprecated in XHTML which, while not exactly the same thing was _intended_ as the successor to HTML 4 – tobyodavies Nov 24 '10 at 05:15
  • @Ignacio Vazquez-Abrams: You're right: AJAX/HTTPRequest can create sames problems with more in a lot of cases if used "like frames"! But it's more a problem about from lack of knowledge of developers than from the technologies itself... – Pascal Qyy Nov 24 '10 at 05:16
  • @tobyodavies: No, they are not: frames are obsoleted in strict XHTML, but not deprecated. But, they are discouraged ^^ – Pascal Qyy Nov 24 '10 at 05:27
  • A state mechanism using a hash URL does avoid the problems created by frames mentioned in PleaseStand's message (e.g., AngularJS with ui-router). – djvs May 11 '15 at 15:19
  • 1
    `iframe` is not obsolete in HTML5. Other frames are though, such as `frameset`. Using an `iframe` is useful for implementing cross-domain application logic. – Max Feb 22 '16 at 10:53
6

Not to answer the OP but rather balance the bashing of framesets.

I find them great and nothing comes close to them when you want your menu intact and still:

  • Visually incorporate 3-rd party pages/apps (phpmyadmin or similar)
  • Viewing doctypes other than html (pdf's or images).
  • Due to its width="x,*" you get a simple "responsive" behaviour.

Also, you can provide smooth menu-animations while fetching main contents.

Used with sense, they're super.

Teson
  • 6,644
  • 8
  • 46
  • 69
  • 2
    Exactly. And for those who don't like frames, there is an ancient indian magic called "NOT USING THEM". Works like a charm, and lets the rest of ppl enjoy the benefits of frames. I mean, really. Does it make any sense to have scoped styles (never introduced officially!) and fixed positioning and calc() and everything JUST to achieve the same effect? Which is, in fact, not even close? I agree frames are not TRENDY. But let's stop tossing a lot of good stuff out the window just because "we don't do it like that". – dkellner May 24 '17 at 20:33
  • Have you considered using iframes as a currently-supported way of accomplishing the same purposes? Interested to know if you've run into anything that can be done with frames that cannot be done just as easily with iframes. – Sean the Bean Aug 10 '17 at 17:53
  • @SeantheBean It depends on your intent. Some things are more easily accomplished with the old Frame methods without having to jump through hurdles. An example would be sizing and positioning the frames. (I've not had the need to do so in years, though.) – Rick Paul Apr 05 '18 at 21:04
  • They are still supported by all major browsers, but don't work with CSS, and pose some headaches for mobile-friendliness (RD). – Jake Jan 26 '23 at 02:19