Developer forum

Forum » Rapido » Open navigation link in a new window

Open navigation link in a new window

Fabio Monte
Reply

Hello

We have a requirement in a project ( https://aci.dw-demo2.com/ ) where we need to have a specific menu link open in a new window.

We don't have a setting in Rapido that allows for that right out of the box so how would it be the best approach to achieve that?


Replies

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Fabio 

Can you write a little more info on what you need? Can you be a little more concrete? As far as I can see on your site, that is already what happens when I click on "Marketing site".

 

Best regards
Karsten Thuen

 
Fabio Monte
Reply

Hi Karsten

When clicking in "Marketing Site" we do continue to the link but the navigation still goes on the same window. 

We would like to implement the value"_blank" to the target attribute but in Rapido, what's the best solution to do it? Set it on the .xslt for example?

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Fabio 

That makes sense. Thank you. I am sorry, I do not know how to logically set this up and implement it in the xslt. And I do not think that behaviour is common for the navigation. 

My suggestion would be to create a new block, containg a button the behaves exactly as you want it to. Add it just after the contact menu item, and give it button style "secondary". This way you will also show to the user that this is a very special link.

You can read more about adding new custom Blocks here: https://doc.dynamicweb.com/rapido/development/blocks/example-1-master-template  

 

Best regards
Karsten Thuen

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Karsten,

 

This is what we used to do in the past:

 

<a>
  <xsl:if test="@Allowclick = 'True'">
    ...
    <xsl:if test="starts-with(@Href, 'http') or starts-with(@Href, 'www')">
      <xsl:attribute name="target">_blank</xsl:attribute>
    </xsl:if>
    ...
  </xsl:if>
  ...
</a>

 

It has served us well, but it may not be completely straighforward for all users.

 

Best Regards,

Nuno Aguiar

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply
This post has been marked as an answer

Hi Nuno 

This is a great fix. We will put it in the Rapido 3.2 release. Thanks.

 

Best regards
Karsten Thuen

Votes for this answer: 1

 

You must be logged in to post in the forum