You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Wolfgang <wk...@ebi.ac.uk> on 2008/01/16 17:14:54 UTC

Ope new tab/window using h:outputLink

Hi,

I use an h:outputLink in an tomahawk tree2 to open an link in a new window.
This is working but the page where I clicked the link navigates then to 
the start page
which is another xhtml page...?

 <t:tree2 id="treeGoSlim"
                     var="node"

                 ...... do other stuff ...
        
                      <h:outputLink 
onclick="window.open('#{node.goTermLink}');">
                           <h:outputText value="#{node.description}"/>
                       </h:outputLink>
</tree2>

Does anyone has an idea why this is happening?

Thanks!
Wolfgang

Re: Ope new tab/window using h:outputLink

Posted by Wolfgang <wk...@ebi.ac.uk>.
Hi Andrew,

sorry for the rather late reply...
target="_new" has the good effect that the page where i clicked the link 
stays
as it is (that's what i tried to achieve) but now a second tab will be 
opened
after clicking the link which then navigates to the start page.

I simply solved the problem by using the following code:

<h:outputLink onclick="window.open('#{node.goTermLink}'); return false">
                                <h:outputText value="#{node.description}"/>
</h:outputLink>

That means i just added the "return false" statement to the outputLink.

Thanks for your help!
Cheers,
Wolfgang


Andrew Robinson schrieb:
> Have you tried using target="_new"?
>
> On Jan 16, 2008 9:14 AM, Wolfgang <wkluge@ebi.ac.uk 
> <ma...@ebi.ac.uk>> wrote:
>
>     Hi,
>
>     I use an h:outputLink in an tomahawk tree2 to open an link in a
>     new window.
>     This is working but the page where I clicked the link navigates
>     then to
>     the start page
>     which is another xhtml page...?
>
>      <t:tree2 id="treeGoSlim"
>                         var="node"
>
>                     ...... do other stuff ...
>
>                          <h:outputLink
>     onclick="window.open('#{node.goTermLink }');">
>                               <h:outputText value="#{node.description}"/>
>                           </h:outputLink>
>     </tree2>
>
>     Does anyone has an idea why this is happening?
>
>     Thanks!
>     Wolfgang
>
>


Re: Ope new tab/window using h:outputLink

Posted by Andrew Robinson <an...@gmail.com>.
Have you tried using target="_new"?

On Jan 16, 2008 9:14 AM, Wolfgang <wk...@ebi.ac.uk> wrote:

> Hi,
>
> I use an h:outputLink in an tomahawk tree2 to open an link in a new
> window.
> This is working but the page where I clicked the link navigates then to
> the start page
> which is another xhtml page...?
>
>  <t:tree2 id="treeGoSlim"
>                     var="node"
>
>                 ...... do other stuff ...
>
>                      <h:outputLink
> onclick="window.open('#{node.goTermLink}');">
>                           <h:outputText value="#{node.description}"/>
>                       </h:outputLink>
> </tree2>
>
> Does anyone has an idea why this is happening?
>
> Thanks!
> Wolfgang
>