After the Ajax asynchronous request succeeds, it needs a new open window to open the URL, using the window.open () method, but the action is not triggered by the user, so it thinks it is unsafe to intercept (though if it is _self there is no limit), even if the Ajax The callback function simulates a user behavior such as click or submit (Trigger (' click ')), and the browser will not be considered to be actively triggered by the user and therefore cannot be safely executed, so it is intercepted.
Workaround:
1, asynchronous to synchronous, that is: Async:false
2. Point the new window to an object, and then modify the object's URL
Like what:
$ ('. Task '). bind (' click ',function() { var w = window.open (); $.ajax ({ ' POST ', '/surveytask ' , ' json ',function () { w.close (); }, function(res) { = res.url; } } );});
Last note: The method of adding a new window on the web dynamically is not suitable for AJAX requests and is still blocked by the browser.
Ajax request succeeded after new window window.open () blocked workaround