How to open a pop-up using JSF without it being blocked by the browser <p>I'm working on a PrimeFaces 6.0, JSF 2.2 (Mojarra 2.2.7) application.</p> <p>I need to load a web page from an external site and highlight a DOM node. My approach is to create a JavaScript function to open a pop-up window, load the web page through a servlet (to avoid cross domain issues) and highlight the node. The parameters I send to my function are generated in a managed bean.</p> <p>I tried to do so in two different ways:</p> <ol> <li>Using <code>RequestContext.getCurrentInstance().execute("myFunction(...)")</code> in my action (yes, I'm using PrimeFaces).</li> <li>Using <code>oncomplete="#{myBean.myJsCall}"</code> on my command button.</li> </ol> <p>Both ways the call is executed and the call is correct, but I run into my browser's (Chromium) pop-up blocker:</p> <p><img src="https://i.stack.imgur.com/hNX6Y.png" alt="The following pop-ups were blocked on this page"></p> <p>Is there a way to open pop-ups in JSF or specifically in PrimeFaces without them being blocked?</p> <p>This is not really relevant, but this is the simplified version of my JavaScript function.</p> <p>I developed this script using plain HTML and JS. There it was opening the pop-up without the blocker interfering. Also, when pasting the call into the console when running the JSF application, the pop-up is opened.</p> <pre><code>function myFunction(url, selector) { var popup = window.open("", "popup", "height=500,width=700"); var req = new XMLHttpRequest(); req.open("GET", url, true); req.onreadystatechange = function() { if (req.readyState === XMLHttpRequest.DONE) { popup.document.open(); popup.document.write(req.responseText); popup.document.close(); popup.document.addEventListener( "DOMContentLoaded", function() { /* Some code highlighting the selector */ }, false ); } } req.send(); } </code></pre>