Forum Discussion

ccv_o's avatar
ccv_o
Copper Contributor
Feb 13, 2024

Unable to launch website in pop-up window or new teams tab

I've built a teams tab app and have a requirement of being able to click on a link and load an external website within the teams environment, and not in an external browser. This could either be in an embedded browser pop-up window or in a teams tab. Did some research and found it could be possible using deeplinks. This is what I have so far to test it out:

import { app } from "@microsoft/teams-js";

const openExternalLink = () => {
   app.openLink({
      deepLink: `https://teams.microsoft.com/l/entity{TeamsAppId}/{TeamsTabId}?msLaunch=true&enableMobilePage=true&suppressPrompt=true&webUrl=google.com`
   // an alternative deeplink format 
   // deepLink: 'https://google.com/',
   });
}; 

 

Is there a more appropriate way to open the webpage in a pop-up or tab? 

I keep getting errors when I run the code above.

The main error I get is: "TypeError: Failed to construct 'URL': Invalid URL"

 

I would appreciate any help.

 

 

2 Replies

Resources