Appendix JS_N_A3

Summary

Requirement: Changes of context are only initiated by user request or with user control.

Details: Use progressive enhancement to open windows on user request.

Examples

Correct code

Refer to the JS_N_A3 live demo for a working example.

<p>
    <a id="demo" href="http://www.accessibilityoz.com.au/">
    	Click this link to visit AccessibilityOz</a>
</p>
var link = document.getElementById('demo');
 
link.addEventListener('click', function(e)
{
    var popup = window.open(link.href);
 
    if(popup && !popup.closed)
    {
        e.preventDefault();
    }
}, false);