Frame (World Wide Web)
{{short description|Conflation of multiple HTML elements for web-page display}}
{{Use dmy dates|date=October 2023}}
{{More citations needed|date=January 2008}}
{{HTML}}
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 in a frame may come from a web site distinct from the site providing the enclosing content. This practice, known as framing,{{cite web|url=https://fairuse.stanford.edu/overview/website-permissions/linking/|title=Connecting to Other Websites|date=2 April 2013|quote=What makes framing different is that instead of taking the user to the linked website, the information from that website is imported into the original page and displayed in a special "frame". Technically, when you’re viewing framed information, your computer is connected to the site doing the framing—not the site whose page appears in the frame.}} is today often regarded as a violation of same-origin policy.
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, concern for usability and accessibility has motivated diminished use of framesets and the HTML5 standard does not support them.
Tags and attributes
The frames in HTML are created using the tag pair. The
tag is a container tag for all other tags that are used to create frames. The
tag replaces the
tag in frameset documents.The
tag defines how to divide the window into frames.
Each frameset defines a set of rows or columns. If user define frames by using the rows
attribute then horizontal frames are created. If user define frames by using cols
then vertical frames are created.
The
element may be included so web browsers with frames disabled (or browsers that do not support frames) can display something to the user, as in this example:
History
{{Expand section|date=January 2008}}
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.{{cite press release|url=http://browserwatch.internet.com/news/story/apple33.html|archive-url=https://web.archive.org/web/20000817100726/http://browserwatch.internet.com/news/story/apple33.html|archive-date=17 August 2000|title=A Present From Apple: Cyberdog 2.0a1|access-date=14 April 2011|publisher=Internet.com|first=Dave|last=Garaffa|date=23 December 1996|url-status=dead}} At that time, Netscape proposed frames to the World Wide Web Consortium (W3C) for inclusion in the HTML 3.0 standard.{{cite web|archive-url=https://web.archive.org/web/20071030083252/http://docs.rinet.ru/HTMLnya/ch13.htm|archive-date=30 October 2007|url=http://docs.rinet.ru/HTMLnya/ch13.htm|title=Using HTML 3.2, Java 1.1, and CGI; Ch. 13, Frames|first=Eric|last=Ladd}}
Frames were used to display and navigate early online magazines and web apps, such as webmail services and web chat sites. 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.{{cite book|last=Shafer|first=Dan|title=JavaScript & Netscape wizardry|year=1996|publisher=Coriolis Group Books|location=Scottsdale, AZ|isbn=978-1-883577-86-5|pages=[https://archive.org/details/javascriptnetsca00shaf/page/31 31]|url-access=registration|url=https://archive.org/details/javascriptnetsca00shaf/page/31}}
XHTML 1.1, the intended successor to HTML 4, removed all frames. XFrames, the intended eventual replacement,{{cite web | url = http://www.w3.org/TR/xframes/ | title = XFrames working draft | publisher = W3C }} provided the composite URI to address a populated frameset.
The later HTML5 standard removed framesets by means differing from XHTML.[http://www.w3.org/TR/html5-diff/ HTML5 differences from HTML4]: "The following elements are not in HTML5 because using them damages usability: frame, frameset, noframes" The iframe
element remains with a number of "sandboxing" options intended for sharing content between sites.[http://www.w3.org/TR/html5-diff/ HTML5 differences from HTML4]: "The iframe element has new attributes called sandbox and srcdoc which allow for sandboxing content, e.g. blog comments."
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.{{cite web | url = http://www.howtocreate.co.uk/tutorials/html/framesets | title = Framesets }} 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.
- The main advantage to frames is that they enable parts of the page to remain stationary while other parts scroll. This is useful for elements you may not want to scroll out of view, such as navigational options or banner advertising.
- Frames unify resources that reside on separate servers. For instance, you may use frames to combine your own material (and navigation graphics) with threaded discussion material generated
Criticism
The practice of framing HTML content led to numerous criticisms, most centering on usability and accessibility concerns. These include:
- Framing breaks the identity between the content and URL as displayed in the browser, making it difficult to link to or bookmark a particular item of content within the frameset{{cite web |url= http://www.useit.com/alertbox/9612.html |title=Frames Suck Most of the Time |first=Jakob |last=Nielsen |date=December 1996}}
- The implementation of frames is inconsistent across different browsers
- Browsers which render material linearly do not handle frames well.{{cite web |url=http://www.htmlcodetutorial.com/frames/frames_famsupp_15.html |title=Should You Use Frames? |publisher=HTML Code Tutorial |access-date=7 April 2010 |archive-date=6 August 2016 |archive-url=https://web.archive.org/web/20160806170805/http://www.htmlcodetutorial.com/frames/frames_famsupp_15.html |url-status=dead }}
- Screen reader programs
- text or audio browsers
- Email browsers such as Agora{{cite web|title=G.E.Boyd's How To Do Just About Anything by email – Part 1|url=http://www.geocities.com/CapitolHill/1236/howto1.html|publisher=GeoCities|access-date=24 June 2010|archive-url=https://web.archive.org/web/20000817030717/http://www.geocities.com/CapitolHill/1236/howto1.html|archive-date=17 August 2000|date=11 August 2000}}
- Mobile browsers
- Framing complicates web indexing and can be detrimental to search engine optimization.{{cite web|url=http://www.lewesseo.com/seo-fundamentals-1/|title=SEO fundamentals 1|last=Moore-Eded|first=Piers|publisher=Lewes SEO|access-date=25 February 2012}}
- Framing confuses the boundaries between content on different servers,{{cite web |url= http://budugllydesign.com/frame9806/frames9.htm |archive-url= https://web.archive.org/web/20020328142514/http://budugllydesign.com/frame9806/frames9.htm |url-status= usurped |archive-date= 28 March 2002 |title=I Hate Frames Club}} which raises issues of copyright infringement{{cite web |url=http://www.html-faq.com/htmlframes/?framesareevil |title=Why are frames so evil?}}
- Visitors arriving from search engines may land on a page intended for display in a frame, resulting in the visitor having no way to navigate to the rest of the site{{cite web |title=The Pros and Cons of Frames in Web Pages |url=http://www.mediacollege.com/internet/html/frames/pros-cons.html}}
- Frames change the behavior of the back button.
- Users usually do not expect browsers to print frames the way they do.
- 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.
Security
Frames create both technical and user-interface difficulties for enforcement of the same-origin policy. As an example of the latter, an outer page can trick a user into performing an action on an inner page (loaded using the iframe element) which has been made 99% transparent.
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 (using position:fixed
)
- Server-Side Includes 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.
- CGI and web-oriented scripting languages and web development frameworks such as PHP and Active Server Pages, as well as database-backed Content Management Systems such as WordPress, provided much richer options for maintaining content and providing navigation.
- Client-side scripting and Dynamic HTML 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.
- 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.
See also
References
{{Reflist}}
External links
- [http://www.htmlhelp.org/design/frames/whatswrong.html HTML Help: What's wrong with frames?]
- [http://webtips.dan.info/frames.html Dan's Web Tips: Frames]
- [https://web.archive.org/web/20120209191256/http://www.4techies.com/webmaster-tips/break-out-of-frames.php Script designed to prevent framing of your content]