Framing (World Wide Web)
HTML |
---|
Comparisons |
In the context of a web browser, a frame is a part of a web page or browser window which displays content independent of its container, with the ability to load content independently. The HTML or media elements that go in a frame may or may not come from the same web site as the other elements of content on display.
In HTML, a frameset is a group of named frames to which web pages and media can be directed; an iframe provides for a frame to be placed inside the body of a document.
Since the early 2000s, the use of framesets has increasingly been considered obsolete due to usability and accessibility concerns, and the feature has been removed from the HTML5 standard.
Syntax
The HTML 4.0 standard included two different forms of frame, frame
element, used inside a special frameset
container, and the iframe
element, used within the body of a document.
In HTML 4.01, a document, which would normally contain a head
and a body
, may instead contain a head
and a frameset
(but not both a body
and a frameset
). The attributes rows
and cols
on the opening frameset
tag define the dimensions of a grid of frames using comma-separated lists of sizes, specified in either pixels or percentages. Any row or column size may be replaced with an asterisk to indicate the remainder of the remaining screen space.[1] Within the frameset
, a series of frame
elements describe the initial source documents for each frame in the frameset, as well as assigning them names for use as the target of links. The <noframes>
element may be included so browsers with frames disabled (or browsers that do not support frames) can display something to the user, as in this example:
<frameset cols="85%, 15%">
<frame src="URL OF FRAME PAGE 1 HERE" name="frame_1">
<frame src="URL OF FRAME PAGE 2 HERE" name="frame_2">
<noframes>
Text to be displayed in browsers that do not support frames
</noframes>
</frameset>
The iframe
element is used inline within a normal HTML body, and defines the initial content and name similarly to the frame
element.
History
Netscape Navigator 2.0 introduced the elements used for frames in March 1996. Other browser vendors such as Apple with Cyberdog followed later that year.[2] At that time, Netscape proposed frames to the World Wide Web Consortium (W3C) for inclusion in the HTML 3.0 standard.[3]
Frames were used to display and navigate early web apps, such as web chat sites and online magazines. Frames had the advantage of allowing elements to be displayed sitewide without requiring server features such as server-side includes or CGI support. These features were not common on early web servers accessible to the public.
Early websites often used a frame at the top to display a banner which could not be scrolled away. These banner frames sometimes included the site's logo as well as advertising.[4]
XHTML, intended as a successor to HTML 4, removed all frames in 1.1. The intended eventual replacement was XFrames,[5] which attempts to solve the problem of addressing a populated frameset through composite URIs.
The later HTML5 standard, which took a different approach to succession from HTML 4, also removes framesets.[6] The iframe
element, however, remains, with a number of "sandboxing" options intended for sharing content between sites.[7]
Advantages
By allowing content to be loaded and navigated independently, frames offered several advantages over the plain HTML in use when they were first developed:
- Simplifying maintenance of content shared across all or most pages, such as navigation data.[8] If an item needs to be added to a sidebar navigation menu, the web page author needs to change only one web page file, whereas each individual page on a traditional non-frameset website would have to be edited if the sidebar menu appeared on all of them.
- Reducing the amount of bandwidth needed by not re-downloading parts of the page which had not changed.
- Allowing several pieces of information to be viewed side by side, with the ability for each section to be scrolled independently. This might include the side-by-side comparison of two pictures or videos, or two different ways to understand something, such as an independently scrolling page of text next to video, images, animation, 3D rotating objects, etc.
- Allowing footnotes or digressions to appear in a dedicated section of the page when linked to, so that the reader does not lose their place in the main text.
Criticism
The practice of framing HTML content led to numerous criticisms, most centering on usability and accessibility concerns. These include:
- Framing breaks the link between content and a URL, making it difficult to link to or bookmark a particular item of content within the frameset[9]
- The implementation of frames is inconsistent across different browsers[9]
- Browsers which render material linearly do not handle frames well.[10]
- Screen reader programs
- text or audio browsers
- Email browsers such as Agora[11]
- Mobile browsers
- Framing causes a site to be difficult to index and is detrimental to search engine optimization.[12]
- Framing confuses the boundaries between content on different servers,[13] which raises issues of copyright infringement[14]
- Visitors arriving from search engines may land on a page intended for display in a frame which has no navigation[15]
- Frames change the behavior of the back button.[15]
- Users usually do not expect frames to print the way they do.[14]
- External links on web pages which use frames may cause other pages to appear in the frameset, since the default behaviour for a link is to load in the current frame if the author does not specify otherwise. This could be used by unscrupulous webmasters to make it appear as though content from another site was actually part of the site hosting the frameset.
- If the screen resolution or browser window size is too low then each frame will have scroll bars which can look messy and uses up already limited space. Such behaviour typically resulted more from bad site design (fixed layouts instead of fluid layouts), whereby not all frameset features were put into proper use.
This behaviour could be mitigated by:- disabling scrolling for smaller frames that typically did not require a scrollbar;
- using fluid design characteristics in target pages instead of fixed designs, so that the content would not cause horizontal scrollbars in the first place.
Alternatives
As web technology developed, many of the purposes for which frames were used became possible in ways that avoided the problems identified with frames.
- Cascading Style Sheets (CSS) allowed elements of a page to be scrolled independently (using the
overflow
property) or held on screen while other content is scrolled (usingposition:fixed
) - Server-Side Includes and PHP allowed shared content to be edited once and automatically delivered to the client as part of a finished page; as server CPU and connection speeds increased, the extra work required to do this on the fly became a lesser consideration.
- The development and widespread deployment of web-oriented scripting languages and frameworks, such as PHP and Active Server Pages, and database-backed Content Management Systems such as WordPress, provided much richer options for maintaining navigation.
- Developments in client-side scripting led to Dynamic HTML, which allowed parts of a page to be visually replaced based on a user's actions. This allowed much more flexibility for showing "side" content, such as footnotes or instructions, as these could now be displayed and hidden anywhere on the page rather than requiring a pre-defined frame.
- The rise of AJAX allowed for dynamic display within a page of content even when it needs to be fetched from the server, for instance based on the logged in user or events elsewhere.
Not all of problems identified with framesets are eliminated by using these alternative approaches; for instance issues with Back/Forward navigation, bookmarking, and indexing remain on many sites which make heavy use of DHTML / AJAX navigation.
See also
References
- ↑ "Frames in HTML Documents". W3C.
- ↑ Garaffa, Dave (23 December 1996). "A Present From Apple: Cyberdog 2.0a1" (Press release). Internet.com. Archived from the original on 17 August 2000. Retrieved 14 April 2011.
- ↑ Ladd, Eric. "Using HTML 3.2, Java 1.1, and CGI; Ch. 13, Frames". Archived from the original on 30 October 2007.
- ↑ Shafer, Dan (1996). JavaScript & Netscape wizardry. Scottsdale, AZ: Coriolis Group Books. p. 31. ISBN 978-1-883577-86-5.
- ↑ "XFrames working draft". W3C.
- ↑ HTML 5 differences from HTML 4: "The following elements are not in HTML 5 because their usage affected usability and accessibility for the end user in a negative way: frame, frameset, noframes"
- ↑ HTML 5 differences from HTML 4: "new sandboxing features for iframe"
- ↑ "Framesets".
- 1 2 Nielsen, Jakob (December 1996). "Frames Suck Most of the Time".
- ↑ "Should You Use Frames?". HTML Code Tutorial.
- ↑ "G.E.Boyd's How To Do Just About Anything by email – Part 1". GeoCities. 11 August 2000. Archived from the original on 17 August 2000. Retrieved 24 June 2010.
- ↑ Moore-Eded, Piers. "SEO fundamentals 1". Lewes SEO. Retrieved 25 February 2012.
- ↑ "I Hate Frames Club".
- 1 2 "Why are frames so evil?".
- 1 2 "The Pros and Cons of Frames in Web Pages".
External links
- HTML Help: What's wrong with frames?
- Dan's Web Tips: Frames
- Script designed to prevent framing of your content