how-to block ads
To the novice webmaster, frames may seem wonderful. However from the user's perspective, frames present a number of challenges.
The biggest (mis)use of frames on a website is to include a static menu on each page. However a frame will break the basic functionality of a browser feature people have come to rely upon: Back and Forward buttons. Trying to navigate back and forward on a frames page may not work exactly like the user expects, since the browser will only go back and forward within a certain frame - not the whole page.
Because the actual web address of each page in a frameset is hidden, you won't be able to bookmark to a specific page, only the main framed site. Yes, you could certainly view the source in your browser to determine the actual address and bookmark that, but this is cumbersome and too much to ask of the average surfer.
For the same reason as above, frames make it difficult for search engines to index your site. Some may even ignore framesets altogether, or in most cases a user will get a result from a search query that links to a single page on your site, and they would view that page out of context since the rest of the frames wouldn't be present.
Not all user agents are capable of rendering frames. This means that some visitors may simply be presented with a blank page. The HTML noframes tag is supposed to be used for non-frames browsers, but then you end up having to maintain two versions of your site - frames and no frames. This is more work in the long run for anyone. Usually most people just use the noframes feature to say something like, "Sorry, this page uses frames". This could completely lock out some visitors from your site - don't do that!
Even if all the reasons above don't apply, there's still hardly a good argument for frames when presented with a number of options for developing a site.
If you have a navigation section, or some other bit of content you want to remain the same on every page, you can use server-side scripting languages to include this information on the fly when the page is loaded. Examples of server-side languages are: SSI (Server-Side Includes), PHP (PHP Hypertext Preprocessor), and ASP (Active Server Pages). What is available to you depends on the type and configuration of your webserver, contact your hosting provider if you are not sure. Even if you are not fluent with these languages, it is very easy to learn how to use the include functions.
If you are using an iframe (inline frame) now, you can easily get the same look by putting your content into a block-level element (such as div or p) and style that element with height and width specifications, and using overflow: auto, which will render a scrollbar for any content that does not fit in the div. This method also has the added benefit of degrading gracefully in browsers that wouldn't support iframes or CSS: the content is still available without providing an alternate version.
So what about the other 0.5% of the time?
So basically frames suck and there's newer, hipper alternatives. When might it be acceptable to use a frame? Perhaps if you have complete control of the user agents and the people accessing your site, you may be able to get away with frames. An example of this might be an intranet site that is only available for employess of a certain company, all of which use the same browser and don't have any disabilities which may make page viewing difficult.
Consider the alternative methods above first though! They give you way more flexibility over your site with the benefit of less work, and they'll make things a lot easier on your users as well.