1

I'm programmimg a web application using knockout.js. There I'm trying to open a new tab on a button click. While it actually works fine on localhost, the popup blocker complains once I deploy the application. Is there any way to avoid the popup blocker considering these circumstances?

Button in the HTML-Code

<button data-bind="click:openNewTab"
        type="button">
    Open new tab
</button>

Piece of JavaScript-Code of the ViewModel which is used from the HTML file mentioned above

self.openNewTab = function ()
{
    var newTabUrl = "https://www.stackoverflow.com";
    window.open(newTabUrl, '_blank');
};
dario
  • 2,861
  • 3
  • 15
  • 34
  • If you think about this for a minute, if there was a way. Then popup blocker's would be useless, as the people wanting to show unsolicited pop-up's would use this technique too. Best option is ask your users to create an exception in there popup blocker, or maybe alter your application to maybe use HTML tabs & IFrames. – Keith Sep 06 '17 at 09:13
  • 2
    Read this [Answer](https://stackoverflow.com/questions/2587677/avoid-browser-popup-blockers) – Miran Senanayaka Sep 06 '17 at 09:26
  • had a similar situation believe I did if !(window.open) then I unhid a link with a message that said you pop up blocker is enabled please click link to continue, – Bryan Dellinger Sep 06 '17 at 11:37
  • 1
    Possible duplicate of [Avoid browser popup blockers](https://stackoverflow.com/questions/2587677/avoid-browser-popup-blockers) – Roy J Sep 06 '17 at 12:00

0 Answers0