The standard popup-blocker logic contained in most browsers these days will block any calls to window.open() that are not the direct result of a user action. Code that is triggered by timers or by any asynchronous callback (like your ajax ready function) will be treated as NOT caused directly by user actions and the new popup window will generally be blocked.
You can verify this is what is happening by temporarily changing your browser's popup blocking (turning it off) and see that it then starts working.
Probably what you need to do as a work-around is to create the window upon the user action that started this thread of code and then put the content into the window when you get your ajax response. The browser will probably allow that. I know that's less desirable from a visual perspective, but you can put some temporary content in the window until the ajax response comes in (something like "loading...").
Answer from jfriend00 on Stack OverflowThe standard popup-blocker logic contained in most browsers these days will block any calls to window.open() that are not the direct result of a user action. Code that is triggered by timers or by any asynchronous callback (like your ajax ready function) will be treated as NOT caused directly by user actions and the new popup window will generally be blocked.
You can verify this is what is happening by temporarily changing your browser's popup blocking (turning it off) and see that it then starts working.
Probably what you need to do as a work-around is to create the window upon the user action that started this thread of code and then put the content into the window when you get your ajax response. The browser will probably allow that. I know that's less desirable from a visual perspective, but you can put some temporary content in the window until the ajax response comes in (something like "loading...").
Just had this exact same issue. Just in case you wanted the code that fixed it. I used this:
newWindow = window.open("", "_blank");
request = $.ajax({ ... my request which returns a url to load ... })
request.done((function(_this) {
return function(data, textStatus, jqXHR) {
return newWindow.location = data.Url;
};
})(this));
Window.open(); doesn't work properly | Vivaldi Forum
Javascript Window Open not working
Having trouble with window.open and _self - JavaScript - SitePoint Forums | Web Development & Design Community
window.open not working as intended
Second parameter must be the window name:
<input type="button" value="new win"
onclick="window.open('http://yahoo.com', 'mywindow', 'width=500, height=400')" />
Working fine in Chrome and Firefox:
http://jsfiddle.net/DvMy5/2/
The second parameter should be name..Something like windowname
<input type="button" value="new win"
onclick="window.open('http://yahoo.com','windowname', 'width=500, height=400')" />
Per https://developer.mozilla.org/en-US/docs/Web/API/Window/open
It appears you need the second param.
window.open(url, windowName, [windowFeatures]);
openWindow(info) {
window.open('http://10.100.100.100:9999/window?someInfo=' + info, '_blank');
},
I was lodged here on search.
I faced such issue only on mobile chrome.
The two param didn't work for me. So i used 3 params.
openWindow(info) {
window.open('http://10.100.100.100:9999/window?someInfo=' + info, '_blank', 'popup=1');
}
or
openWindow(info) {
window.open('http://10.100.100.100:9999/window?someInfo=' + info, '_blank', '');
}