Page Content
HTML frames can be problematic because:
- Some browsers, including mobile browsers, may have problems processing frames.
- Individual pages can be difficult to bookmark.
- The organization of the pages may not be clear to screen readers.
- There is less screen space that can be used to present content.
For these reasons, many users manually switch out of frames view for many sites. Consider avoiding frames unless they are needed for a particular Web application. If frames are needed, remember these tips:
Synopsis
- Generally speaking, iFrames are better supported on screen readers than traditional HTML frames.
- Clearly identify each frame or iFrame in the following way:
- Include the TITLE attribute for each frame. The text within these attributes should describe the contents of the frame (e.g. "navigation" or "content") not position ("top" or "right") or an arbitrary number ("frame 1" or "frame 2").
- Make HTML file names for each frame meaningful (e.g. "navigation-menu.html") in case that is what a screen reader identifies.
- Include a text title on each frame (it can be hidden in visual browsers).
- Use the DOCTYPE declaration below for Web pages with frames. Doing so will signal a page with frames to a screen reader.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
WCAG Guideline 4.1.2—For all user interface components (including but not limited to: form elements, links and components generated by scripts), the name and role can be programmatically determined; states, properties, and values that can be set by the user can be programmatically set; and notification of changes to these items is available to user agents, including assistive technologies.
- Whenever possible, include duplicate navigation within the content frame. Especially important is a link to the site map in case users right-click a frame to view it by itself (thus manually leaving frames mode).
- Include
<noframes>
content, including basic navigation functions, so your site is usable to older browsers that do not support frames. - A link to a "No Frames" version of the site is often recommended. It is generally best to place this link towards the top of the homepage.
- Most content management systems allow Webmasters to use templates to standardize site headers, navigation and footers. Another option for some sites are server side includes added to each page.
iFrames: Sample Accessible Code
In general, iFrames are accessible on a screen reader, but a TITLE for the iFrame is recommended. See example of a Google Form iFrame below.
View HTML for Accessible iFrame
<iframe title="Survey Form Frame" src="https://spreadsheets.google.com/embeddedform?formkey=" width="760" height="820" frameborder="0" marginheight="0" marginwidth="0">Loading...
</iframe>
Frames: Sample Accessible Code
Top Title Frame My Accessible Frames Site |
|
Left Navigation Frame
MAIN MENU |
Right Content Frame H1 Header Here for Page Title Rest of content Duplicate navigation for accessibility |
View the Code for Accessible Frames
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<head>
<title>A page that contains frames</title>
</head>
<body>
<frameset rows="80,*" frameborder="no" framespacing="0" border="0">
<frame src="titlebar.html" title="Title Bar">
<frameset cols="175,*" frameborder="no" framespacing="0" border="0">
<frame src="mainmenu.html" title="Main Menu" name="mainmenu">
<frame src="initialcontent.html" title="Page Content" name="content">
</frameset>
</frameset>
Note that all NAMES , TITLES and file names indicate which type of content is available. Avoid using generic names like "left frame" or "frame01".
No Frames Skeletal Navigation
Here is an example of NOFRAMES code with skeletal navigation that makes the site accessible to non-frames browsers.
<noframes>
<h1> Welcome </h1>
<p> This page... </p>
<h2> Main Menu </h2>
/!-- Alternative No Frames Navigation --/
<ul>
<li> <a href="page1.html">Page 1</a></li>
<li> <a href="page2.html">Page 2</a></li>
<li> <a href="page3.html">Page 3</a></li>
<li> <a href="pagen.html">Page n</a></li>
</ul>
</noframes>
</frameset> </html>