Target='_blank' to show in new window, NOT new tab, possible?

后端 未结 9 1170
逝去的感伤
逝去的感伤 2020-11-27 17:25

How can I do this?

In firefox the link opens in a new tab... I don\'t want users to have to set settings of their browsers for this...

I want a pop-up to app

9条回答
  •  旧巷少年郎
    2020-11-27 17:59

    You cannot control this.

    But you can try to open in a new window and then show an alternative solution if the browser rejects the attempt.

    You can accomplish this by checking the return value of window.open().

    var win = window.open(strUrl, strWindowName);
    if (!win) {
        // Call failed. Handle it here. 
        // You can for example open content in a model or show a button that 
        // will open content in a new tab
    }
    

    window.open documentation: https://developer.mozilla.org/en-US/docs/Web/API/Window/open

提交回复
热议问题