[英]Opening url in new tab from dropdown select
I have this and i can't get it to work on Safari for OS X (Safari 8.0). 我有这个,我无法在OS X的Safari(Safari 8.0)上运行。 It works on Firefox and Chrome but i simply cannot get it to work in Safari.
它可以在Firefox和Chrome上运行,但我根本无法在Safari中运行它。
function myChangeHandler()
{
window.open(this.options[this.selectedIndex].getAttribute('value'), '_blank');
this.form.submit();
}
What am i missing? 我想念什么?
Thanks 谢谢
I'm not sure what doesn't work since there is no specific problem that is posted but I'm guessing it's the window.open()? 我不确定什么是行不通的,因为没有发布特定的问题,但是我猜这是window.open()吗?
I found this article 我发现这篇文章
window.open(url, '_blank');
window.open(url,'_blank'); not working on iMac/Safari
在iMac / Safari上无法使用
it might be the one you were looking for. 它可能是您正在寻找的那个。
From: Kelly J Andrews 来自: 凯利·J·安德鲁斯
The standard window.open() JavaScript method cannot be used to open a new tab and window from a global HTML file or an extension bar.
无法使用标准的window.open()JavaScript方法从全局HTML文件或扩展栏打开新的选项卡和窗口。 Instead, the global file and extension bars have access to the SafariApplication, SafariBrowserWindow, and SafariBrowserTab classes, whose methods and properties allow you to work with windows and tabs.
相反,全局文件和扩展栏可以访问SafariApplication,SafariBrowserWindow和SafariBrowserTab类,这些类的方法和属性使您可以使用窗口和选项卡。
It goes on to explain how you can use 继续说明如何使用
var newTab = safari.self.browserWindow.openTab();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.