Not many websites use frames nowadays because more people are following web standards, more designers are worrying about usability and it is probably also a side-effect of searchengine optimisation, but from time to time I still accidentally stumble on stupid uses of framesets. This made me think about something I wrote a while back and I decided to post it here so that I don’t lose it forever.
Problems with frames in general
- Many search engines do not index pages with frames very well. Google is one example - see Google’s Webmaster Info pages for more information.
- Framed pages cannot be bookmarked. In extreme cases I have seen this resulting in websites reinventing the wheel by adding custom “bookmark” systems.
- Printing a page with frames can be difficult or at least buggy.
- Screen reader software for the visually impaired cannot handleframes well, neither can cell phones.
- New web users sometimes get confused when one part of a page scrolls and the rest stays still.
- Frames can be very difficult to develop for, because if you have to reload another frame, you have to do it with javascript. The javascript will only run after the one frame reloaded, creating a delayed effect. You can only break out of frames again using javascript, so server-side redis won’t help you fix problems. It can be very difficult micro-managing things if anything other than the “main frame” ever changes, different browsers load frames, script tags, etc. in a different order, therefore bugs like race conditions / “threading” issues can creep in. (This is more relevant to web apps than normal websites)
- You cannot have an external link that takes you directly to the right section in a site (example: you want to email someone a link directly to an article) unless you jump through hoops with lots of unnecessary code. I’ve had this issue before and there is no easy way around it.
Problems with using a frameset as a “redirect”
- Internet explorer and other browsers sometimes complain about security if you have a frame that loads a url on a different domain.
- If a frame on one domain (a) loads a site on another (b) andthat site sets a cookie, then IE won’t send the cookie along by default, because the cookie is assigned to domain b and it thinks you are on domain a. This breaks logins, polls, etc.
In short
From personal experience: sooner or later frames will bite you in the ass. Avoid them.
Possible workarounds
- If you don’t want to show people ? and & characters in their URLs, then use nice clean urls. Perhaps using some apache rewrite rules. In many cases you can just write static versions of pages every time they change (like many blog systems do)
- If you want to redirect someone to a new url, use a server-side redirect rather than making a frameset that includes the other site.
Leave a Response