Techniques for WCAG 2.0

Skip to Content (Press Enter)

This document is a draft, and is designed to show changes from a previous version. It is presently showing added text,changed text,deleted text,[start]/[end] markers,and Issue Numbers.

Hide All Edits   |   Toggle Deletions  |   Toggle Issue Numbers   |   Toggle [start]/[end] Markers   |   Show All Edits

Changes are displayed as follows:

-

F52: Failure of Success Criterion 3.2.1 [begin add]and 3.2.5[end add] due to opening a new window as soon as a new page is loaded

Applicability

Applies when scripting is used to open new windows.

This failure relates to:

Description

Some Web sites open a new window when a page is loaded, to advertise a product or service. The objective of this technique is to ensure that pages do not disorient users by opening up one or more new windows [begin add]that automatically attain focus[end add] as soon as a page is loaded.

Examples

Note: There are multiple methods by which this failure may be triggered. Two common examples that are supported differently in various versions of user agents are listed as examples below.

Failure Example 1:

The following example is commonly used in HTML 4.01 to open new windows when pages are loaded.

Example Code:


window.onload = showAdvertisement;
 function showAdvertisement()
 {
  window.open('advert.html', '_blank', 'height=200,width=150');
 }

Failure Example 2:

The following example commonly used in XHTML to open new windows when pages are loaded.

Example Code:


if (window.addEventListener) { 
    window.addEventListener("load", showAdvertisement, true);
}
if (window.attachEvent) {
    window.attachEvent("onload", showAdvertisement);
}
function showAdvertisement()
{
window.open('noscript.html', '_blank', 'height=200,width=150');
}

Resources

Resources are for information purposes only, no endorsement implied.

Tests

Procedure

  1. load a new page

  2. check to see whether a new window has been opened as a result of loading the new page

  3. [begin add]

    Check to see whether the new window is automatically given focus

    [end add]

Expected Results