Open external url dynamic link in new tab (no new window) in Chrome
Hello,
We need to navigate to a external link in response to user double-click in a row table.
We've succesfully created the code to invoking a managed bean as response of double-click user event. For that, we added a clientListener object to the table object, and add the javascript code to queue the actionEvent for launching the backing bean code.
In backingBean code, we execute code to calculate link url based on several conditions, (e.g: depending on a type object, url is http://server1/data.asp?param=..., or http://anotherserver/miApp/exp.cfm?d=2&p=..., ... and so on)
Now we have the URL string, we invoke code to open the page in the new tab, but, the new page always is opened as a new window, not as new tab in the current browser.
We have tried with several code:
1)
String script = "window.open('" + sURL + "');
ExtendedRenderKitService service = Service.getRenderKitService(FacesContext.getCurrentInstance(), ExtendedRenderKitService.class);
service.addScript(FacesContext.getCurrentInstance(), script);
2) String script = "OpenNewTab('" + sURL + "');
ExtendedRenderKitService service = Service.getRenderKitService(FacesContext.getCurrentInstance(), ExtendedRenderKitService.class);
service.addScript(FacesContext.getCurrentInstance(), script);
and adding the js function in our scripts:
function OpenNewTab(url){
var oFormNewPest = document.createElement('FORM');
oFormNewPest.method = 'get';
oFormNewPest.target='_blank';
oFormNewPest.action = url;
document.body.appendChild(oFormNewPest);
oFormNewPest.submit();
}
This function works fine in others app we have, but when it's invoked inside ADF app, we get a new window insted a new tab.
We need to open a new tab, doesn't matter the method used.
Any ideas?