Situation
We are facing a situation where we need to open a new tab in browsers after an XHR / Ajax request is made by clicking on something.
To achieve this, we set the Ajax request to be synchronous in order to maintain the context of the trusted click event and so far it has been working well.
Issue
However, with the latest version of Chrome (36), we are running into popup warnings when there is a delay in the Ajax call. Just a 2-second lag triggers a popup warning instead of opening the tab as expected. The code functions normally when there's no lag, but once there is a delay, the popup warning shows up.
Query
We are wondering if there is a timeout applied to synchronous Ajax requests that must be completed for the trusted event to still work properly?
Is there any workaround for this issue? Keep in mind that the call is already synchronous and halts everything else until the result is received.
Thank you.
Update JSFiddle
Update: I have prepared a JSFiddle to illustrate the problem: http://jsfiddle.net/23JNw/9/
/**
* This method will open the popup without triggering a warning.
*/
function performSlowSyncronousRequest() {
$.ajax({
url: '/echo/html',
data: {delay: 2}, //JSfiddle will delay the response by 2 seconds
success: function(){
window.open('http://www.thirtykingdoms.com'); //this causes the popup warning in Chrome
},
async: false
});
}