I read that if a user clicks a link, then you can use JavaScript to open it and it will not be blocked by a popup blocker. You can see that here:
Allow window.open to open new window and not popup
So, in angular, I created this directive:
.directive('kdExport', function () {
return {
restrict: 'A',
scope: {
options: '=kdExport'
},
controller: 'ExportImageController',
link: function (scope, element, attrs, controller) {
// Bind to the onclick event of our button
element.bind('click', function (e) {
// Prevent the default action
e.preventDefault();
// Copy our options
angular.extend(controller.options, scope.options);
// Generate the image
controller.generateImage(function (preview) {
// Create our url
var url = '/kits/preview/' + preview.id;
// Open a new window
window.open(url, '_blank');
});
});
}
};
})
The problem is that it gets blocked in IE. How can I prevent IE from blocking this link?