简体   繁体   English

打开新标签页而不移动到该标签页

[英]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.

相关问题 在不打开新标签的情况下打印HTML - Print HTML without opening in a new tab 提交表单而无需打开新窗口或标签 - Submitting form without opening new window or tab 在不打开新标签或更改当前标签视图的情况下下载 pdf - Downloading a pdf without opening new tab or changing current tab view Chrome 扩展:webRequest 重定向到现有选项卡,无需打开新选项卡 - Chrome Extension: webRequest Redirect to Existing Tab, Without Opening New Tab 导航栏链接到特定的引导程序选项卡,而无需打开新窗口或选项卡? - Navbar link to specific bootstrap tab without opening new window or tab? 在同一选项卡中启动下载,而无需在 Javascript 中打开新选项卡或窗口 - Launch download in the same tab without opening new tab or window in Javascript 以编程方式打开新标签而不刷新引用页面? - Opening new tab programmatically without refreshing referring page? 以编程方式确定是否在浏览器中启用了弹出窗口阻止程序,而无需打开新选项卡 - programmatically determine if the popup blocker is enabled in a browser without opening the new tab 有什么方法可以让用户在不打开新标签的情况下单击URL? - Is there any way to let the user click a URL without opening a new tab? 在不打开新窗口/标签的情况下使用 Google 身份验证登录 - Login using Google authentication without opening new window/tab
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM