Detection of whether react app is running in Teams or Web browser?

Copper Contributor

Currently, I'm trying to get context using getContext() and trying to decide whether it's running in Teams or Browser.
Is there any other better way to move ahead with this?

3 Replies
Yes, get context will work on browser. Are you facing any issue? Could you please share more details?

Actually, the callback inside getContext() is not being executed when the website is being opened in the browser. Please see this once -> https://stackblitz.com/edit/react-cuadoi?file=src%2FApp.js

Where did you assign the value to the teamscontext variable? Could you please try printing the context directly using console and check in dev dev tools?