Frame (World Wide Web) Explained

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,[1] 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 <frameset></frameset> tag pair. The <frameset> tag is a container tag for all other tags that are used to create frames. The <frameset> tag replaces the <body> tag in frameset documents.The <frameset> 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 <noframes> 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: Your browser does not support frames. <a href="http://www.example.com/frame_1.html">Click here</a> to view frame 1. <a href="http://alt.example.com/frame_2.html">Click here</a> for frame 2.

Framesets have a border attribute. If set to an integer greater than 0, the user can resize the frames by dragging this border, unless a noresize attribute is present in a frame element. If border is set to 0, no border will be displayed and content in different frames will abut each other without delineation.

The iframe element is used inline within a normal HTML body, and defines the initial content and name similarly to the frame element. Any text inside an <iframe></iframe> tag pair will be displayed in browsers that do not understand the iframe tag.

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 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.[4]

XHTML 1.1, the intended successor to HTML 4, removed all frames. XFrames, the intended eventual replacement,[5] provided the composite URI to address a populated frameset.

The later HTML5 standard removed framesets by means differing from XHTML.[6] The iframe element 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:

[9]

Criticism

The practice of framing HTML content led to numerous criticisms, most centering on usability and accessibility concerns. These include:

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.

See also

External links

Notes and References

  1. Web site: Connecting to Other Websites. 2 April 2013. 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..
  2. A Present From Apple: Cyberdog 2.0a1. https://web.archive.org/web/20000817100726/http://browserwatch.internet.com/news/story/apple33.html. 17 August 2000. 14 April 2011. Internet.com. Dave. Garaffa. 23 December 1996. dead.
  3. Web site: https://web.archive.org/web/20071030083252/http://docs.rinet.ru/HTMLnya/ch13.htm. 30 October 2007. Using HTML 3.2, Java 1.1, and CGI; Ch. 13, Frames. Eric. Ladd.
  4. Book: Shafer, Dan. JavaScript & Netscape wizardry. 1996. Coriolis Group Books. Scottsdale, AZ. 978-1-883577-86-5. 31. registration.
  5. Web site: XFrames working draft . W3C .
  6. http://www.w3.org/TR/html5-diff/ HTML5 differences from HTML4
  7. http://www.w3.org/TR/html5-diff/ HTML5 differences from HTML4
  8. Web site: Framesets .
  9. News: Roberts, L . John . CSS and SEO . 28 January 2022.
  10. Web site: Frames Suck Most of the Time . Jakob . Nielsen . December 1996.
  11. Web site: Should You Use Frames? . HTML Code Tutorial . 7 April 2010 . 6 August 2016 . https://web.archive.org/web/20160806170805/http://www.htmlcodetutorial.com/frames/frames_famsupp_15.html . dead .
  12. Web site: G.E.Boyd's How To Do Just About Anything by email – Part 1. GeoCities. 24 June 2010. https://web.archive.org/web/20000817030717/http://www.geocities.com/CapitolHill/1236/howto1.html. 17 August 2000. 11 August 2000.
  13. Web site: SEO fundamentals 1. Moore-Eded. Piers. Lewes SEO. 25 February 2012.
  14. Web site: I Hate Frames Club.
  15. Web site: Why are frames so evil?.
  16. Web site: The Pros and Cons of Frames in Web Pages .