Azure Bot C# : Webchat Open url in same Tab of Browser, Its opening in new tab

I am able to open that link using HeroCard – CardAction, but requirement is to open that link into same tab Not in another new tab of browser.

To achieve your requirement, you can try to clone the repo, then modify the source code and compile into your own version.

In AdaptiveCardContainer.tsx, we can find it opens new browser window using the following code:

if(action instanceof OpenUrlAction) {
    window.open(action.url);
}

We can modify the code to window.open(action.url,"_self"), then build changes and use our own version Web Chat in website.

Test result:

enter image description here

Leave a Comment