JSFiddle - React, Tailwind, and code Playground

HTML

<h1>window.open demo</h1>
<p>Click the link below to open the popup (see Javascript code for failure cases).</p>

<a href="#" id="opener">Open popup</a>

<p class="result">Result: window.open can only be invoked from <i>real user-initiated</i> action. Synthesized events and general inline script execution of window.open fails.<br/><br/>Tested in Opera 11.5, Chrome 12, Firefox 5 and Safari 5.</p>

CSS

h1 {
    font-size: 30px;
}
p {
    margin: 10px;
}
p.result {
    font-size: 12px;
}

JavaScript

var opener = document.getElementById('opener');

// Success case 1: This only opens if the real user clicks the anchor element 
opener.addEventListener('click', function() {
    window.open('http://google.com');
}, false);

// Failure case 1: Popup blocker prevents window.open from a synthesized event
opener.click();

// Failure case 2: Popup blocker prevents window.open from general inline script
window.open('http://google.com');