Tutorial :Why should I not use HTML frames? [closed]



Question:

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?


Solution:1

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.


Solution:2

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.


Solution:3

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.


Solution:4

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).


Solution:5

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.


Solution:6

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.


Solution:7

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


Solution:8

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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »