确保在新窗口中打开的Javascript方法(不是Tab) [英] Javascript Method to Ensure Open in New Window (not Tab)
问题描述
请耐心等待( JavaScript打开一个新窗口,而不是标签),但执行链接的方法是不同的。当应答软电话时,我通过第三方应用程序打开销售脚本应用程序。如果销售代表已打开浏览器窗口(并且它们始终打开),则会在现有窗口中打开一个新选项卡,并且它并不总是很容易引起注意。他们要求我总是让我的应用程序弹出一个新窗口,但尽管我可以告诉我唯一的方法是通过浏览器的首选项。是否有任何机会一些我不知道的javascript会取消一个标签?我怀疑答案是否定的,但不得不问。
感谢您的时间!
我想也许这最初可能超出了问题的范围,但我认为它可以阐明我想要做的事情:第三方应用程序(iSymphony)在本地计算机上运行并监听我们的事件呼叫控制器。当rep回答时,它会触发一个URL,该URL在系统的默认浏览器中打开。我真的无法控制它是如何打开的,这就是为什么我希望有一个javascript解决方案来确保我在一个新的窗口。
如果在调用 window.open
时指定宽度和高度,大多数浏览器将在新窗口而不是选项卡中打开链接。 / p>
window.open(url,'_ blank','width = 300,height = 200');
小提琴: http://jsfiddle.net/kelervin/Pf8Rw/
参见这个问题供讨论和更多细节。
如果意图是引起用户的注意,您可以考虑添加桌面通知(假设支持Chrome浏览器的浏览器是一种选择)。
参见这个答案的例子,它可能正是您所寻找的。 p>
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" application via a third party application when a soft phone is answered. If the sales rep already has a browser window open (and they always do), a new tab is opened within the existing window and it isn't always readily noticeable. They are requesting that I always have my application pop a new window, but as near as I can tell the only way to do this is via the browser's preferences. Is there by any chance some javascript I am not aware of that will "undock" a tab? I suspect the answer is no, but had to ask.
Thanks for your time!
[EDIT] I thought maybe this was out of scope of the question initially, but I think it could shed light on what I am trying to do: A 3rd party app (iSymphony) runs on the local machine and listens to events on our call controller. When the rep answers, it fires a URL, which is opened in the system's default browser. I don't really have any control over how it's opened, which is why I was hoping for a javascript solution to ensure I was in a new window.
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.
这篇关于确保在新窗口中打开的Javascript方法(不是Tab)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!