I need to open a tab with a new URL from JSF via Javascript. 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:
<h:commandButton value="#{appRes['xyz']}" action="#{someBean.downloadFromDetails()}"
rendered="#{someBean.isDownloadAvailableOnDetails()}" onclick="showUrl();" onblur="location.reload();"/>
and here is my Javascript code:
function showUrl() {
window.open('http://www.stackoverflow.com');
}
This is my idea...
function showUrl() {
window.open(window.location);
window.location='http://www.stackoverflow.com';
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.