[英]Opening new tab without moving to it
I need to open a tab with a new URL from JSF via Javascript. 我需要通过Javascript使用JSF中的新URL打开一个选项卡。 The problem is that I don't know how to open it without moving to this newly opened tab.
问题是我不知道如何在不移动到此新打开的选项卡的情况下将其打开。 In other words, I want to open a new tab, but stay on my current page.
换句话说,我想打开一个新选项卡,但留在当前页面上。
here is my JSF code: 这是我的JSF代码:
<h:commandButton value="#{appRes['xyz']}" action="#{someBean.downloadFromDetails()}"
rendered="#{someBean.isDownloadAvailableOnDetails()}" onclick="showUrl();" onblur="location.reload();"/>
and here is my Javascript code: 这是我的Javascript代码:
function showUrl() {
window.open('http://www.stackoverflow.com');
}
This is my idea... 这是我的主意
function showUrl() {
window.open(window.location);
window.location='http://www.stackoverflow.com';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.