Skip to content

Technique G201:Giving users advanced warning when opening a new window

About this Technique

This technique relates to:

This technique applies to pages that open new windows.


The objective of this technique is to provide a warning before automatically opening a new window or tab. Opening new windows automatically when a link is activated can be disorienting for people who have difficulty perceiving visual content, and for some people with cognitive disabilities, if they are not warned in advance. Providing a warning allows the user to decide it they want to leave the current window, and the warning will help them find their way back, if they do decide they would like to go to the new window. It will help them understand that the "back" button will not work and that they have to return to the last window they had open, in order to find their previous location.


Example 1: Including the warning in the text describing a control

The name or label that describes a control can include the warning about opening in a new window.

<a href="knitting.html" rel="noopener" target="_blank">
  All about Knitting (opens in new window)

Example 2: Using CSS to provide a warning before opening a new window

The code below uses CSS to provide a warning before opening a new window.

<!DOCTYPE html>
<html lang="en">
  <meta charset="utf-8">
  <title>Link opens in new window notification</title>
    body {
      color: #000;
      font: 1rem/1.5 system-ui, "Segoe UI", Roboto, Helvetica, sans-serif;

    [hidden] {

    .new-window-icon {
  <svg hidden>
    <symbol id="new-window-icon" viewBox="0 0 12 12">
      <title id="new-win-desc">opens in a new window</title>			

  <h1>Link opens in new window notification</h1>
  <p>This is an example of an 
     <a aria-describedby="new-win-desc" href="" rel="noopener" 
     target="_blank">external link<svg class="new-window-icon" aria-hidden="true"
     role="img"><use href="#new-window-icon"></use></svg></a></p>

A working example of Using CSS to provide a warning before opening a new window is available.



For each link that opens automatically in a new window or tab when a change of context is initiated by a user request:

  1. Check that there is a warning spoken in assistive technology that this link opens to a new window.
  2. Check that there is a visual warning in text that this link opens to a new window.

Expected Results

  • Checks #1 and check #2 are true.
Back to Top