21

I haven't used frames since 1998. They seem like a bad idea and in all my development I've never had a situation where frames were the right solution, or even a decent solution.

However, I'm now working with an internal web application written by another group and the entire site is built in a - header, left side menu, right side content - frameset.

For one, when VPN'd to my network I constantly get a "website.com/frames.html" cannot be found." error message. This doesn't happen when I'm on the internal network.

Second, the app has a built in email/messaging system. The number of unread messages is shown in the left side menu frame as "Messages (3)" but the count doesn't update as I read the messages. The developer told me since it was in a frame I needed to right click on the menu and 'Refresh'. Seriously????

So, my programming related question is, what reasons do you have for not using frames in a website?

rvarcher
  • 1,566
  • 1
  • 12
  • 14
  • 3
    I think you have answered your own question – redsquare Jul 29 '09 at 21:14
  • In part, but I'm also looking for more answers different than mine. – rvarcher Jul 29 '09 at 21:26
  • Your browser's refresh button is for the main page. There's only one _main or _index so the others need to be manually refreshed as if they were their own, because they actually are. Nobody answered below so I figured, eh... was a fun run through history of the web :) – Stephen J Oct 18 '12 at 19:39
  • A label can be updated from one frame to another using javascript: https://stackoverflow.com/questions/6981349 – Gringo Suave Dec 16 '20 at 01:17

8 Answers8

15

Although they solved a problem at the time they were created (updating part of a "page" while keeping in place a non-updating part), framesets were criticised in terms of usability pretty much from the start, as they break generic functions of the browser, such as:

  • bookmarking, and copy-and-pasting URLs to share
  • printing the page as displayed on the screen
  • reloading the page: since the URL has generally not changed, you will often be taken back to the site's homepage or default frameset; manually reloading some frames is possible, but not obvious to the user
  • back and forward buttons are ambiguous: undo/redo the last frame change, or take you to the last time the URL bar changed?

The heaviest burden of avoiding framesets - including the same content on every page - is trivial to solve if you are using any server-side language to generate your HTML, even if all it provides is a "server side include". Unlike framesets, a server-side include could occur anywhere on the page; building a site with a server-side scripting language or templating system has other obvious advantages too.

There is still an advantage to being able to update small areas of the page without reloading the entire content, which can be achieved via AJAX. This sometimes leads people to create interfaces with all the problems of framesets outlined above, but that is hardly an argument in favour of framesets. Again, a site built with well-designed AJAX functionality can achieve things which framesets don't even begin to address.

IMSoP
  • 89,526
  • 13
  • 117
  • 169
10

One good reason to avoid frames today is they have been deprecated in HTML 5: Chapter 11 Obsolete features

11.2 Non-conforming features

Elements in the following list are entirely obsolete, and must not be used by authors:

[...]

frame

frameset

noframes

Either use iframe and CSS instead, or use server-side includes to generate complete pages with the various invariant parts merged in.

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
8

The #1 reason? Users hate them.

Even if they offered advantages in other areas (separation of code, application design, speed etc) they are part of the user interface. If users don't approve, don't use them.

nbro
  • 15,395
  • 32
  • 113
  • 196
Spencer Ruport
  • 34,865
  • 12
  • 85
  • 147
7

Frames were vaguely useful when you had a static web site, to avoid repeating navigation menu in all pages, for example. It also reduced the overall size of a page.

Both these arguments are obsolete now: sites don't hesitate to serve fat pages, and most of them are dynamically built so including such navigational parts (or status, etc.) has no problem.

The "why" part is well answered above, partly by your own question (you hit a limitation, although it can be overridden with a bit of JS).

nbro
  • 15,395
  • 32
  • 113
  • 196
PhiLho
  • 40,535
  • 6
  • 96
  • 134
6

My number 1 reason not to use frames is because they break the bookmark (aka favorite) feature of browsers.

With the technology that exists today, frames have become obsolete. But if your legacy project still uses them, you can make the messages update with some ajax.

Peter Di Cecco
  • 1,548
  • 5
  • 15
  • 26
5

Just because of the cell phone iPad craze doesn't mean that highly functional full featured sites are suddenly "obsolete", and those who decided to make framesets obsolete seem to be the same complainers who never figured out their full potential in the first place, or maybe they're the lobbyists of the mega-corporate cell-phone and tablet makers who couldn't be bothered to make a decent frames capable browser for their itty-bitty screens.

Admittedly, iFrames can handle simple jobs like scrolling and/or displaying independent segments within a single page pretty well, and I use them for that inside my own frames based website, but to get them to work as well as the foundation for a site itself is a nightmare. Trust me, I know because my website is one of the most sophisticated frameset based sites on the Internet and I've been looking at the pros and cons of transposing it all to iFrames. Nightmare is an understatement.

I can already hear the whiners saying, "Well why did you build it that way in the first place then?" ... and the answer is A: Because I'm not lazy. and B: Because a frames based site is the most functional, visually appealing, and user friendly format for an information based site with hundreds of pages of content that doesn't have to rely on a server. By that I mean all but the external advertising can be viewed straight off a flash drive. No MySQL or PHP needed.

Here's some of the issues I've encountered:

  • The objection to orphaned pages can be easily handled with JavaScript.
  • The objection regarding bookmarking is irrelevant unless you use no frames all.
  • Content specific bookmarking can be handled with an "Add Bookmark" JavaScript function
  • The objection regarding SEO is easily handled by an XML sitemap and JavaScript.
  • Laying out dynamically sized frames is far easier and more dependable with standard framesets.
  • Targeting and replacing nested framesets from an external frame is easier with standard framesets.
  • In-house scripts like JavaScript searches and non-server dependent shopping carts that are too complex for cookies don't seem possible with iFrames, or if they are, it's way more hassle to get them working than using standard frames.

All that being said, I like the single page appeal of iFrames, and when they can actually do all the same stuff for my site as easily as standard frames does now, then I'll migrate. In the meantime, this nonsense about them being "obsolete" is as irksome as the other so-called "upgrades" they've foisted on us over the years without thinking it all the way through.

So what does all this boil down to for the question of whether or not to use framesets? The answer is that it all depends on what you want your site to do and on what platform it will mostly be viewed on. At some point it becomes impractical to make a multi-page site work well without some frames or iFrame integration. However if you're just creating a basic profile page that displays well on a cell phone or tablet, don't bother with framesets.

IconMatrix
  • 175
  • 2
  • 6
  • 3
    The one decent point buried in that rant is that for an offline website, framesets provide a simple alternative to server-side processing. For any internet-based website, however, your constant mention of iframes suggests you've completely misunderstood why framesets went out of fashion, which was in favour of a) server-side includes of common content and b) AJAX-powered dynamic content within a single page. – IMSoP Apr 10 '13 at 23:10
  • You obviously noticed that I mentioned the use of client-side scripting. Not everyone wants or has the technical capacity or the money to hire those who do, to create the fine functionality possible with standard frames. As for "not understanding" iframes, that is also part of the point. The site I have already works fine with what I do understand and figuring that out was easy compared to what I'm running into in an effort to migrate to iframes. – IconMatrix Apr 10 '13 at 23:21
  • I didn't say you don't understand iframes, I said you didn't understand that iframes aren't what most people use to replace the functionality of framesets. For that, people use server-side page generation and AJAX. – IMSoP Apr 10 '13 at 23:24
  • Fair enough, but a bit misdirected. Allow me to clarify. I made the comment in response to people who say things like, "iframes can do everything framesets can", which you'll run across frequently as a rationale for not using standard framesets, and which prompted me to explore iframes as an option for a site upgrade because they're in the latest standards. In that context, I think your comment makes perfect sense to those already in the know. But for those who built sites before the popularity of all the server side programming, it's a different story. – IconMatrix Apr 10 '13 at 23:48
  • 3
    OK, I've never heard that line, but it would explain your misunderstanding. If anything, iframes have all the same *problems* as framesets, and are certainly no panacea. The other big misunderstanding in your post is that this has something to do with mobile browsers; framesets have been considered a bad idea for many many years, and removing them from the HTML5 standard is really just an act of tidying up. – IMSoP Apr 11 '13 at 00:01
  • Framesets haven never been an inherently "bad idea". If anything it's quite the opposite. They are very advantageous when implemented properly and in the right circumstances. For example when you want an extensive independently scrollable index on the side of a page. But that's something cell phones and most portable devices ( except laptops ) don't display well. So ironically all the technical progress has dumbed down website functionality to the lowest common denominator. That and/or multiple versions and/or apps for different devices. – IconMatrix Apr 11 '13 at 00:15
  • 1
    Obviously, "bad idea" is a subjective statement, but there have been alternatives for most if not all uses of framesets for a long time, and the vast majority of websites do not use or need framesets. Your last example can be achieved using [the CSS `overflow` property](https://developer.mozilla.org/en-US/docs/CSS/overflow), among other approaches. – IMSoP Apr 11 '13 at 00:29
  • @IMSoP Exactly what you said on your first comment. I do software user guides in HTML (they look prettier for the user). I use frames, left part is contents area with expandable lists and right part is user guide for each item. Also with some javascript and url manipulation you can open a specific part of the webpage as if the user navigated to it and keeping the frame logic – John Demetriou Jan 15 '15 at 07:34
2

They almost always make people angry. What more do you need?

Nosredna
  • 83,000
  • 15
  • 95
  • 122
  • 3
    They indeed have done that. I think I'm dealing with a developer who is very detached from the end-user experience. – rvarcher Jul 29 '09 at 21:27
2

Frames are really useful in some occasions. If you are creating a local webpage that serves only for reading, no interactivity involved and the website will not be public on the internet, all the reasons on not to use frames are removed. For example a user manual for an application that is developed solely in html, frames are really useful in keeping a table of contents on the left in a simple and easy to code way. Also if you have proper navigation within the website then the back button ambiguity is removed completely

John Demetriou
  • 4,093
  • 6
  • 52
  • 88
  • 2
    However good your navigation, it does not remove the usefulness of the back button, because different users want to navigate in different ways, and you should be supporting *as many ways as possible*, not *whichever way(s) you like best*. When designing the Office ribbon, Microsoft engineers found that although copy and paste are the most common keyboard shortcuts, they're also (by a huge margin) the most common toolbar clicks, which is why the ribbon has huge buttons for them. – IMSoP Feb 23 '15 at 18:50
  • @IMSoP recent browsers support the back button when navigating within frames........ And I am talking about offline webpages, no server side. How should one replicate this effect? – John Demetriou Feb 23 '15 at 19:03
  • I do agree that frames are an easy way to achieve certain things in the circumstance where you are limited to static HTML with no server-side logic (or pre-generation from templates). I was just disagreeing with your last sentence: "if you have proper navigation within the website then the back button ambiguity is removed completely". – IMSoP Feb 23 '15 at 19:08
  • by ambiguity I mean the back button not working properly. Test it in a browser now. It works as intended. The refresh on the other hand does not – John Demetriou Feb 23 '15 at 19:28
  • 1
    Hm, OK. I wasn't very clear on what you meant by "proper navigation" and "ambiguity is removed". But yes, browsers are better than they used to be at coming up with a meaningful action for it. – IMSoP Feb 23 '15 at 19:38