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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Frameset - The Misunderstood Tag

Frames

Frameset - The Misunderstood Tag

by  CliveC  Posted    (Edited  )
INTRODUCTION

At its simplest level a frameset is just a list of pages that you would like to appear within the same browser window. Here is an example:

<html><frameset cols="35%,*">
<frame src="menu.htm" name="MENU" />
<frame src="text.htm" name="TEXT" />
</frameset></html>

Doesn't look too scary does it? It isn't ... read on!

To view this FAQ as a frameset, use this link:
http://tubularity.com/frameset/


DEFINING TERMS

Frame:
A frame is just a regular page. It doesn't even know that it is a frame. In fact if we just called a "Frameset" a "Pageset" there might be less confusion. This could be a page or a frame. Click here to view: http://tubularity.com/frameset/tag/page1.htm

Perhaps more interestingly, this could be a page or a frame and it would work as well outside of a frameset. Try clicking on a menu item. Click here to view: http://tubularity.com/frameset/tag/menu.htm"

Frameset:
A frameset is two or more frames (pages) arranged in a single browser window. Actually a frameset could just have one frame, as it might be used in a case where you wanted to hide the changing content of the browser address window as you clicked on links within the page.

Typically framesets use at least two frames per frameset. Generally speaking, limiting a frameset to the fewest frames possible is best. Do you recognize the frames in this frameset? Click here to view: http://tubularity.com/frameset/tag/fset.htm

Website:
Generally speaking we think of a website as a site containing a page, or pages, posted on the internet or on an intranet. However, HTML pages can be used on a local machine without any web server at all. In fact, if HTML had been invented before word processing we would probably not have bothered with proprietary word processing products. Any wysiwig (what you see is what you get) HTML generator would work just as well as a word processor.

For the purpose of this document let us expand the definition of a website to include a site used locally without any connection to the internet or to an intranet. Indeed this is a reason why frames are so useful as they can be used on the desktop without server-side code or JavaScript.


WEBSITE USAGE

When to use a frameset:

On any website...
* requiring navigation among pages
* having duplicate information on each page
* that is laid out as a book
* requiring JavaScript parameter passing
* where it would be useful to see more than one page in the same browser window

Novels, of course, are hard to read on a computer. However, reference books are ideal for the medium since searching for a word or phrase is possible. Imagine how much easier school Shakespeare would have been, online: http://tubularity.com/h41/

Framesets are useful for organizing data because they can provide both a table of contents and an index with very little effort. A left frame may contain links to anchors in the right frame and indexing is automatic using the browsers inherent ability to search for words or phrases.

When not to use a frameset
* For page layout purposes (tables or CSS are better)
* When bookmarking at the page level is necessary
* When you have only one page


FRAMESET ALTERNATIVES

Strictly speaking there are no alternatives. There is no other way of showing two separate pages within the same browser window, other than with the close relation, IFRAMES (inline frames). Inline frames allow you to include another page within a regular page.

Tables and CSS:
Tables and CSS can be used for layout purposes. However, as has already been noted, page layout is a trivial and poor use of framesets.

Server side includes:
Server side includes overcome the maintenance problem of repetitive data in pages. Unfortunately they do not prevent the unnecessary reloading of screen data. This is not a trivial consideration when using images or complex mark-up or when displaying data on a handheld device.


FRAMESETS AND HANDHELDS

Navigation type framesets, as it turns out, work incredibly well in handheld devices. This is because handhelds typically ignore tags they cannot work with. In the case of a frameset they will use the <noframes> tag or, in some cases, simply present any links found within the frameset code even if the <noframes> tag is not present.

Handhelds have such limited screen real estate that it is beneficial to present navigation data in a separate screen and return to it after going to each link. Try this frameset http://tubularity.com/mobile in a regular browser and then in a handheld. If you do not have a handheld device there are many emulators around... here is one: http://mtld.mobi/emulator.php?emulator=nokiaN70&webaddress=tubularity.com/mobile



MISCELLANEOUS POINTS

Orphan Pages:
Orphan pages, ie. pages found outside of the context of their website can easily be remedied by always providing a link to the frameset or by forcing orphan pages into the frameset with JavaScript, e.g.:

Code:
if (top.location == self.location)   {
    self.location.replace
    ("index.htm")
}

Search Engines:
Search engines have no problem spidering frameset sites. This is not conjecture... simply look up a frameset site on your favorite search engine.

Web Applications:
Framesets are an ideal way to write vertical market web applications because they allow you to require only a different frameset page (rather than a whole application) for each user. For example and this, for brevity, is only a trivial example. Type in your information to the form at http://tubularity.com/frameset/tag/form.htm and click the send button:

This works because any JavaScript variables stored in the frameset page code are available to any page in the application regardless of that page's direct parentage.

If all a users variables are stored in the frameset page, other pages can refer to those variables as variables and thus can serve many users.


CONCLUSION

Many articles advise avoiding framesets. This is out-of-date advice based on early browser technology circa 1966.

Framesets are far more widely and consistently supported than CSS or even tables.

Information changes rapidly in this fast-paced technology and bad information abounds. It has been my experience that the best way to understand and evaluate things is to experiment with them.

Make your own frameset here: http://tubularity.com/kiss/ and play around with it. Happy coding!

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top