# Failure of Success Criterion 3.2.5 due to opening a new window as soon as a new page is loaded

ID: F52

Technology: failures

Type: Failure

## When to Use

Applies when scripting is used to open new windows.

## 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 that automatically attain focus as soon as a page is loaded.

## Examples

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.

### example commonly used to open new windows when pages are loaded

    window.addEventListener("load", showAdvertisement, true);
    window.attachEvent("onload", showAdvertisement);

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

## 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. Check to see whether the new window is automatically given focus

### Expected Results

- If check #2 and check #3 are true, then this failure condition applies and content fails the Success Criterion.

## Related Techniques

- G107

## Resources