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

New 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 ->

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?