Friday, December 15, 2006

HTML Frames are the Devil

I’ve given this rant to everyone who has ever uttered the word "frames" to me, but much to my dismay there are some web designers who want to use frames on their sites! It is not ok. Frames are the worst. (You too iframe) Frames are the devil and this is why:

The MAIN problem is that HTML framed pages are not “addressable”. This means that each page in an HTML frame does not have its own distinct URL. Only the main “frame” page has a URL and all of the internal content does not. This might not sound SO bad, but it actually ruins everything that is good about the Internet and makes me cry at night. For example, when using frames:
  • Bookmarking pages doesn't work – A bookmark is usually just a saved URL and a title. If you're surfing around on a framed website then see something you like and bookmark it, next time you go back to the bookmark you won't see the page you saved, you will see the main frame page. Internet Explorer has pulled some trick to save the internal frames, but that's no excuse to make crappy websites.
  • Sending links to friends doesn't work - Again, if you're on a framed site and copy the URL and send it to a friend with a note like "Wow! The specific content on this page I surfed to is delightful!" your friend won't see what you saw, just the original frames. According to the US Census, frames are responsible for 6% of divorces in the US.
  • Frames annihilate your search engine traffic - Search engines basically follow links around the Internet and save each page with its associated URL. If you use frames, then all of the URLs on your site are the same, and the search engine skips them. This is the absolute worst thing you can do for your search engine rankings. It will basically prevent ANY traffic from finding your site through search engines. Alternatively, if you don't use frames and give all your pages nice, descriptive titles the search engine traffic will flow in.
  • Social networking doesn't work - You can't tweet, facebook, or otherwise share specific links inside of frames. If Sally sees a page she loves and want to share with her friends and posts it to facebook, the friends will see an odd page that's not what Sally intended.  Sally will get zero likes on her facebook post and will spiral into an unhealthy routine of self-loathing and binge-watching of Jersey Shore reruns.
  • Frames are not accessible - Accessibility on the web can be a intricate problem, but using frames is a sure way to hose your site. FOR EXAMPLE, I happen to be in the airport right now where they charge $8 for stupid Internet access. Instead of flushing $8 down the toilet, I tried to check my work e-mail from my handy-dandy web-enabled phone. But guess what, the web interface for my work e-mail uses FRAMES and my phone doesn't support frames, so I get no e-mail. I kicked a small dog just to make frames feel some of my pain. In addition to phones or PDA's there are many other types of alternative browsers (like a screen reader for blind people) that choke on frames. There is a <noframes> tag to address this, but instead of using that, why don't you stop sucking and stop using frames.
  • Frames produce non-standard behavior - When you use frames you risk having a user view one of your "internal" frames without the template around it. This makes you and your site look stupid. I know it's possible to use javascript to force the internal frame to appear in the correct frameset, but if you're coherent enough to do that, why don't you stop contributing to the political unrest in the Middle East by stop using frames!
So what do you do if you don't use frames? The answer is to use a server-side programming language like PHP or ASP.NET. This lets you get all the deliciousness of keeping your template code in one place, with none of the baby-killing involved in using frames! If you're integrating with another site, that site should provide a way to customize a template to look like your site, instead of being trapped in an iframe of your site.

Are frames EVER ok to use? Well, if you think you have some exceptional circumstance where frames is the only option, I encourage you to pour a bucket of ice water on your genitals and re-think that decision. HOWEVER, there are some respectable sites (i.e. Google) that do use frames for VERY SPECIFIC PURPOSES. Basically if you can decisively say that none of the points above applies to your task, frames MIGHT be okay. Google uses them with their image search to show the user the page the image appears on without "really" leaving the Google site. But Google makes damn sure to provide every necessary step to make the frame as innocent as possible (like a "Close this frame" link)

In conclusion, don't use HTML frames. Frames kill independent George. If you must use a frame, just put a picture in it and put it on your wall. (Although as a political statement, all the artwork in my house is nailed to the wall with no frame)