How to make URLs open in new tab in adaptive cards

Copper Contributor

 

We have created one Spfx adaptive card extension to use in Viva dashboard. We need to show some hyperlinks in the card. We have used the markdown language as shown below to show this. But the hyperlinks are opening in the same tab.

{
"type": "TextBlock",
"text": "**[${Title}](${URL})**",
"wrap": true
}

Also we tried using Action.OpenUrl as shown below. With this also the links are opening in the same tab.

"actions": [
{
"type": "Action.OpenUrl",
"title": "View More",
"url": "${URL}"
}
]

Is there way we can force the links in adaptive cards to open in new tab.


Thanks.

2 Replies

@Mahesh_Kottappurath As per documentation, Adaptive card Action.OpenUrl does not have any property using which you can provide input to open link in new or same tab.

 

Can you try using markdown links in below format (not tested): 

 

[link](URL){:target="_blank"}

 

You can try other ways to do it at: Can I create links with 'target="_blank"' in Markdown?  


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

@ganeshsanap Thank you for the suggestions.

It seems the below option is not working.

[link](URL){:target="_blank"}

 

Also as mentioned in Can I create links with 'target="_blank"' in Markdown?  , it seems adaptive card json not supporting html formatted text as mentioned here https://github.com/Microsoft/AdaptiveCards/issues/433.

 

The rendered html for the link already has target="_blank" attribute. But still its opening in the same tab. This https://learn.microsoft.com/en-us/sharepoint/dev/spfx/hyperlinking could be the reason for it.