Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

To frame or not to frame? 4

Status
Not open for further replies.

engcomp

Programmer
Jun 18, 1999
66
0
0
AU
I often see the advice NOT to use frames. Is this advice outdated or are there still valid reasons for it?

Personally, I like frames because my menu of links (in the left margin) is stationary while the main page is being scrolled.

I use a dark background for the menu area and a white background for the main page. Consequently, the link colours are different in these two areas. No problem with frames because each area uses a different style sheet.

The same two-colour effect can be created with tables. In this case, the menu scrolls with the page. Now I have only one style sheet. How can I set up different link styles on the one page - (i) standard where the background is white; and (ii) non-standard where the background is dark?

You help is very much appreciated.
 
hi engcomp,
well.........the advice u got was not outdated..but holds.....see using frames is not a profesional approach and also ill-looking particularly when u use more than 2 frames..and also when u refresh the content of a html page in a particular frame the whole page wil get refreshed..resulting in time waste....

u can achieve the same effect of frames (i.e. having menu on one side and dynamic content on other side) by using external javascript files (.js files)....i.e having the general menu content in a js file and calling it in every html page and u can modify it to suit ur needs...this makes the site more professional

Take care,
Regards,
R.Subramanian
 
I don't think the use of frames is particularly unprofessional, I just don't like them very much. It's cumbersome to have to create a frameset AND two pages just to get a single page to display. I do think that the only valid use I've seen for frames is the situation engcomp mentioned above, where he uses a left frame to keep the menu from scrolling off the page. There are other ways to accomplish the same thing, but they are cumbersome. That being said, I still don't use frames.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
hi,
and one more thing engcomp that goes against the use of frames is when u use menu in the left hand side frame for navigating ur website....quite often ppl come to ur site thru search engines (unless otherwise it is very popular)...in those cases the url that the search engine directs to ur site may be to a page which is not the index of ur page....so what happens is the visitor gets into ur site and may get stranded as to how to visit other pages of ur website (bcoz in those cases only that web page gets displayed and not the entire frameset)...so it is advisable not to use frames
 
I try to avoid using frames as well (as it is cumbersome like tsdragon said) but sometimes a client wants something that can only be achieved by using frames. As far as I am well informed there is a way around all the disadvantages mentioned(getting indexed by search engines, displaying the particular frame within the frameset when directly linking to this page). And you can achieve some interesting effects by using frames.

Ron
 
engcomp,

As you can see, frames are controversial. It's only fair to warn you this note is long and detailed - some opponents of frames say nothing about ways of getting the benefits while avoiding / mitigating the drawbacks, so I've described a few.

This note assumes all the processing is done in the browser, because I don't know whether server-side programming is avaiable to you.

Considering the length of this note you may wonder whether frames are worth the trouble. If you want a vertical navigation bar your options are:
* present it as simple HTML within each page and accept that the user will have to scroll the entire page to get to the menu. You also have to keep all the copes of the menu bar in al the pages up-to-date, and decide how to highlight the men option representing the currnet page.
* use DHTML. There are several techniques but the big difficulties are that 14% of users run with Javascript turned off and that different browsers support different DHTML models so your code would have to contain a lot of "if browser A do X else do Y" logic.
* use frames because they are more uniformly supported by browsers and less work that the previous 2 options (version 1 of my site, used frames with no Javascript because I had not learned Javascript at that stage).

For a wide range of opinions on frames look at and search for frames

Things you should consider:
* accessibility, i.e. ease of use by people with visual and other disabilities. Several countries have laws requiring at least some kinds of site to cater for with visual and other disabilities.
* getting listed by search engines.
* what happens if a user follows a link to a page you expect to be displayed in the frameset. Can they see your menu?
* bookmarking
* printing
* legal implications of accidentally showing someone else's page in your frameset.

Almost the first question is whether your site has to be concerned about "accessibility", i.e. ease of use by people with visual and other disabilities. Frames are very visual and the devices with which blind users translate pages into synthesised speech or braille don't understand frames. But in the long run I suspect sites concerned about accessibility will have 2 versions of the relevant pages, for the blind and for other users, because:
* blind users need text-dominated / text-only pages which can be read in strict line-by-line sequence.
* users with "normal" vision don't want to read lots of text and like visual cues such as having the menu in a vertical band with a different background.
See the section "End of Single-Design Pages?" in Jakob Nielsen's article "Disabled Accessibility: The Pragmatic Approach" at
For users with "normal" vision, having the menu in a vertical band with a different background is a good idea. There are other ways of achieving this beside frames (see but most rely on Javascript and about 14% of users have Javascript turned off (see
For the moment I think frames are often the lesser evil (my site, uses frames).

To improve your chances of getting listed by search engines, put in your frameset page a NOFRAMES block which links to all your content pages - and keep this up-to-date!

Solutions to most of the other issues depend on Javascript and will not work for the 14% who don't run Javascript. I suggest you include in all your pages NOSCRIPT blocks which say it will be much easier to use your site if they enable Javascript.

If a user follows a link to a page you expect to be displayed in the frameset, you can use 2 Javascript "programs" to force the page into your framset:
* a separate file, included in all your content pages, which loads the framset and passes it the URL of the required content page, e.g.
self.location.replace('frameset.htm?page=' + escape(self.location.href);
* code in the frameset which parses the "?page=required_page.htm" part of its URL (self.location.href) and loads the required page into the content frame.

Book-marking is the tough nut. I dont'know why browsers only bookmark the visible URL (as shown in the address / location bar) and not the complete status of the frameset. They do track the complete status of the frameset, as you can see by moving around any frames site and then using the Back and Forward buttons.
IE 4+ and Netscape 4+ will bookmark a framed page if the user right-clicks in the content frame and selects the appropriate option from the pop-up menu. The bookmark will refer to the framed page only (i.e. the content page will try to display with frames), but the Javascript code described above will get round that. If you rely on this you should add some help text.
You could make all the links in in your pages, including the menu, of the form
frameset.htm?page=required_page.htm
When the frameset reloads it will use the Javascript described above to load the required content page and the displayed URL will be
frameset.htm?page=required_page.htm
so bookmarks will work even if the user simply uses the browser's toolbar / menu to bookmark the page.
The only disadvantage I can see is that reloading the framset will cause the entire screen to flicker, even if everything is loaded from the browser's cache.

Version 4+ browsers will print a framed page if the user right-clicks in the content frame and selects the appropriate option from the pop-up menu. If you rely on this you should add some help text.
According to an article I read you can also print the entire frameset by Javascript code
top.window.focus();
top.window.print;
but I haven't tried this.

Be very careful about linking from a framed content page to another site's page. Some sites regard this as an attempt to re-badge their content and will sue.
To link from a framed content page to another site's page, do one of:
* set the TARGET attribute to "_top" so that your frameset is overwritten by the requested page.
* open the other page in a new window, e.g. by setting the TARGET attribute to "_top" so the page opens in a new window and your frameset is still present in the original window.

You'll be relieved to know that's all! I suggest you review the options (straight HTML, DHTML or frames) before committing yourself to any work.
 
Thank you, philcha, for such a thorough comment. Also many thanks to rsubras, tsdragon and safra for nailing the subject. I will carefully consider the options as suggested by philcha before committing myself to frames.

The effect I want is a stationary vertical menu bar while the rest of the page scrolls. There are so many options to achieve this effect, I am frozen into inaction.

Warmest regards to all, Helmut
 
I only have a small addition to philcha's statement (besides that I agree fully with him): Not only people with visual disabilities will have some problems with Framesets but also most mobile users (Palms, WinCE). Though I must say that pretty many pages without frames are not that well displayed either (because the menu or other important parts are only shown via images).

I think the best option for a static menu is the following:

* Display the menu in a table in the normal view, give this table a name
* When the user scrolls for the first time, use DHTML to hide this table (that is also shown when DHTML is inactive) and show a layer (not supported by some browsers, check this before you hide the table)
* When further scrolling occurs place the menu layer where it should be

This way you also have a menu in browsers that are a little older (I won't say outdated loudly ;-)) and on smaller devices, but the full functionality will be available in the newer browsers...

Hope this helps
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
Thank you, Haslo

I have re-read philcha's statement after your comment. You guys can put in a brief sentence what other people expand into text books. What a wonderful forum this is.

The upshot is this: (i) I chucked out frames (with a sense of regret because I think the concept serves well); (ii) I adopted a table within a table for the link menu; (iii) I don't know how to use DHTML and "layers" to make the menu stationary, like it would be with frames.

Could you please expand? Warmest regards, Helmut
 
By the way:

I very simply answered my question ... "How can I set up different link styles on the one page - (i) standard where the background is white; and (ii) non-standard where the background is dark?"

The non-standard styles are:

A:link { text-decoration: underline;
color: yellow }

A:visited { text-decoration: underline;
color: yellow }

A:hover { text-decoration: underline;
color: red }

... and the links on the white pages simply have this superimposed:

<A style=&quot;color:blue&quot; ...
 
As far as the problem with search engines directing people to one frame of a frameset and thereby losing the menu frame, that problem is very easily handled with about two lines of javascript that will force the entire frameset to be loaded whenever someone tries to load just one of the frames.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
The use of frames is in no way unprofessional, although it
at times presents you with some trouble. The search engine
problem isnt a problem. You can tell search engines which
page to index and which page not to. Go to
for a good idea about this. Also a simple JavaScript could solve your search engine troubles:

<script language=&quot;JavaScript&quot;>
<!--

if (self.location = parent.location)
{self.loaction == &quot;index.html&quot;}

//-->
</script>

While on the other side there are some good advantages too!
Like it will speed up your webpage because you can put your
banner ads inm a seperate frame and your menu. Causing the
information pages to load faster because they don't need the
codes and scripts for the banner ads and the menu anymore.
This will also be an advantage on a slow server since it is
proven that the avarage user will leave if a webpage isn't
(at least partially) visible after 17 secondes. Also frames
can be usefull when you need to carry information across
document and you dont want to use cookies because of the
obvious limitations. Besides making webpages look alike for
frames isn't a big problem anymore since MSIE and NN both
reasonably support CSS. Even the use of templates can
simplify that problem by making a basic appearance and
then adjusting whatever needs adjusting (like the page
title and content and stuff like that).

I feel that frames are welcome tool in the webdesigners
arsenal.

I won't mention any drawback because enough have been
mentioned already ;-)

BobbaFet Everybody has a right to my opinion.
E-mail me at cwcon@programmer.net
 
hi,
i would like to stand by the point that frames is unprofessional :) sorry for that anywayz

okiee...as far as now, search engine is not a problem...okay..but how about having a framed page with one particular frame alone changing...in case a person wants to refresh that particular content.....what happens is that whole page gets refreshed and user have to wait for it to load completely....

and how about the plight of unix or any console users??? i have worked in lynx browser and was frustrated to see two links one directing to the menu page......if i follow one link and want to go to another one i have to come back and click on the next one........ This must also be taken into consideration
 
What a can of worms I opened:

1. I liked frames but thought I would ask the experts before committing myself to a whole site.

2. The experts came down on frames so I changed from frames to tables without being really convinced.

3. Then it looked as if frames was OK, after all (see BobbaFet).

4. Now it seems I did the right thing to drop frames.

Is the question &quot;To frame or not to frame?&quot; settled or still open?

Thank you all for your contributions, Helmut.

BTW: The site in question is
 
hi engcomps,
so finally u have decided on ur website eh?

btw pal.......are u a structural engineer?? ( i saw ur website..)..that is really great.....btw me too a civil engineer basically (now working as s/w )....anyway nice to see a fellow civil engineeer specialised in structures...My father too is a well experienced structural engineer only

btw ur website is great buddy.......just keep it up
 
Thank you, rsubras

I needed your encouragement because there are so many ways of skinning this cat; I keep sucking on my pencil instead of pushing ahead with the work that needs doing. You have given me the right push.

Warmest regards, Helmut
 
BobbaFet: thanks for your helpful JavaScript.
Please can you check the syntax, before I try it ?
== and // looks wrong.
(I have no experience with Java).
Here is a frame application: hopefully working correctly.
I got important help in this Forum. --Gernot
 
Have a look at the following URL to see what I meant with the floating menu DHTM JavaScript thingy:


I did not make this page - but it's pretty much the concept I proposed earlyer.
allow thyself to be the spark that lights the fire
haslo@haslo.ch - www.haslo.ch​
 
Haslo: it works, but the question is then:
No Frames but JavaScript.
For the simple effect &quot;fixed Menue Bar&quot; the complexity
of Java is rather high (and here the Menue bar is jumping).
Which browsers don´t accept frames at present ?
How many Web receivers (percentage) use these systems ?
---Gernot
 
Greetings:

I thought that I might add my two cents worth on this subject.

I just republished a shopping site that uses frames following much research and pondering the pros and cons of frames, what it seems like forever. The more questions that I asked about using frames or not, the more confused I became because it seems everyone that writes or comments on web programming carries a different opinion on the subject. The solution for my dilemma, then, was to try a smaller shopping site that uses frames to find out for myself.

The original site, published in 1997, didn’t use a frameset for navigation, (I can’t remember if we could then, anyway), but image maps that are now considered passé by some. The site used Selena Sol’s PERL shopping cart and other programmer’s e-mail auto responder, parser, and so on. The site worked well, but looked a bit on the archaic side, thus the upgrade.

What convinced me to use a simple frameset this time was Selena Sol again. Extropia, Selena Sol’s company and web site, offers a new PERL freeware-shopping cart that uses frames. I didn’t use Sol’s cart for this new version of the site because it is far too heavy for what I wanted to accomplish. I am saving that for a larger site now on the drawing board, since I have a simpler test site that uses a frameset to use as a baseline.

Nevertheless, this new site, just up for four days, is generating interest and we had to ask people not to use the toll free line for reasons other than to order. What that says to me is that many people are using the site (the logs confirm it) and we haven’t yet received a complaint on its design.

I was aware of the search engines possibly landing a user in a frame without a navigation set, and so to solve this risk, I placed a link on every page that will load the navigation frame with a few words of explanation. Quite a simple solution I think, but time will tell.

To conclude, the new site uses a lot of JavaScript, DHTML, MySQL, PERL, CGI/DBI and HTML, of course. I am quire curious to see how all this works over a few weeks, and then I will know whether or not to use frames in the future.

I can keep this thread updated if you wish.

Thanks for all the great answers posted above.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top