Javascript Method to Ensure Open in New Window (not Tab)

前端 未结 1 483
日久生厌
日久生厌 2021-02-06 17:53

Bear with me as this might seem similar to ( JavaScript open in a new window, not tab), but the method by which the link is executed is different. I am opening a \"Sales Script

相关标签:
1条回答
  • 2021-02-06 18:23

    If you specify the width and height when you call window.open, most browsers will open the link in a new window rather than a tab.

    window.open(url, '_blank', 'width=300,height=200');
    

    Fiddle: http://jsfiddle.net/kelervin/Pf8Rw/

    See this question for discussion and more detail.

    If the intent is to get the user's attention, you could consider adding desktop notifications (assuming a browser like Chrome that supports them is an option).

    See this answer for an example, it might be just what you're looking for.

    0 讨论(0)
提交回复
热议问题