JS: window.open not blocked

Window.open blocked

Document ready execute
window.open('https://www.example.com')
Ajax callback
$.ajax
  url: 'http://www.example.com'
  method: 'get'
  success: ->
    window.open('http://www.example.com/success')
  error: ->
    window.open('http://www.example.com/error')

Window.open not blocked

Click event
<a id="window-open" href="javascript:;">Click me</a>
$('#window-open').click ->
  window.open("http://www.example.com")

Playground

Click and ajax
Use Click event set blank window
<form action="/fake/post" accept-charset="UTF-8" method="post" remote="true">
  <input type="submit" value="Click" id="window-open-with-ajax">
</form>
$('#window-open-with-ajax').click ->
  newWindow = window.open()
  frm = $('form')

  frm.submit (e) ->
    e.preventDefault()
    $.ajax
      type: frm.attr('method')
      url: frm.attr('action')
      data: frm.serialize()
      success: ->
        newWindow.location.href = 'http://www.example.com/success'
      error: ->
        newWindow.location.href = 'http://www.example.com/error'

Playground

Reference: