Opening embedded hyperlinks in new browser tab

Hi,


Is there a provision to open hyperlinks presesnt in a document in a new browser tab(by default) instead of the same window?

Hi Shashi,


Thanks for posting your query.

Can you please tell us which GroupDocs.Viewer API you are using? Also, please mention the version number along with. We shall be looking forward to your response.

Warm Regards

Hi,


I am using GroupDocs Viewer for .Net version 17.2

Hi Shashi,


Thanks for providing the required details.

Currently, GroupDocs.Viewer for .NET API does not provide any builtin feature to render the hyperlinks to be opened in new tab. However, you can achieve this by injecting target="_blank" attribute in hyperlink tags in the HTML content of the page. Following is a sample code to achieve this:

List pages = htmlHandler.GetPages(guid, options);

foreach (PageHtml page in pages)
{
<span style=“color: rgb(0, 0, 128); font-family: “Courier New”; font-size: small;”> string htmlContent = page.HtmlContent.<span style=“color: rgb(0, 0, 128); font-family: “Courier New”; font-size: small;”>Replace("<a ", “<a target=’_blank’”);
}


Try this and share your feedback with us.

Warm Regards

This works as expected. Thanks Usman.