Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Open external url dynamic link in new tab (no new window) in Chrome

romoracleFeb 28 2012 — edited Oct 6 2012
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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 3 2012
Added on Feb 28 2012
6 comments
3,930 views