window.open(url, '_blank'); not working on iMac/Safari

The Solution to window.open(url, '_blank'); not working on iMac/Safari is


Safari is blocking any call to window.open() which is made inside an async call.

The solution that I found to this problem is to call window.open before making an asnyc call and set the location when the promise resolves.

var windowReference = window.open();

myService.getUrl().then(function(url) {
     windowReference.location = url;
});

~ Answered on 2016-09-08 09:39:46


Most Viewed Questions: