Search code examples
xpages

How to open links in rich text field in new tab


I have an XPages app. How can you open a link in a new tab, if the link is in a rich text field?

Source code:

<xp:inputRichText value="#{document1.Demo}" id="inputRichText3">
<xp:this.dojoAttributes>
<xp:dojoAttribute name="toolBarType" value="Slim">
</xp:dojoAttribute>
</xp:this.dojoAttributes>
</xp:inputRichText>

Solution

  • Something like this could do it

    dojo.addOnLoad(function(){
    dojo.forEach(dojo.query(".xspInputFieldRichText a"),function(aTag)
    {dojo.attr(aTag,"target","_blank");
    });
    });