title: Blocking pop up while using window.open in javascript
body: <p><strong>Actually my real scenario is</strong></p>
  
  <p>When user opens the modal pop up (say bootstrap modal pop up <a href="http://getbootstrap.com/javascript/#modals" rel="nofollow">http://getbootstrap.com/javascript/#modals</a>), we need to open a url which is already saved by the user. </p>
  
  <p>So for that I have tried to open with window.open. But this is always blocking me. Is there any way to overcome this?</p>
  
  <p><strong>The following scenarios I have tried.</strong></p>
  
  <p>When I try to open using <code>window.open(link, '_blank');</code> and if browser has the blocked the pop up, then I restricted by browser to open the url in new tab.</p>
  
  <p>To over come this I have tried like (following) creating anchor link and triggering click event. But this is  also not also working.</p>
  
  <pre><code>var link = document.createElement('a');
  link.setAttribute('href', url);
  link.target="_blank";
  var event = document.createEvent('MouseEvents');
                                              event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
                                              link.dispatchEvent(event);
  </code></pre>
  
  <p>Some websites by passing this feature.</p>
  
  <p>For example, 
  <a href="https://www.online.citibank.co.in/" rel="nofollow">https://www.online.citibank.co.in/</a>.</p>
  
  <p>When I click log in button, a new window is opening. They also doing the same functionality as <strong>window.open</strong>. But the browser is not blocking citibank new window.</p>
  
  <blockquote>
    <p>I don't know what is the reason behind this. How to implement this
    feature?</p>
  </blockquote>