Forum Discussion

lazycipher's avatar
lazycipher
Copper Contributor
Feb 25, 2021

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

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?
    • lazycipher's avatar
      lazycipher
      Copper Contributor

      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

      • Nikitha-MSFT's avatar
        Nikitha-MSFT
        Former Employee
        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?

Resources