Search code examples
javascriptbrowsermicrosoft-teams

How do browsers invoke external applications such as Teams or Zoom from just a URL?


When I paste an URL generated by Teams into a browser (particularly Chrome), the browser asks me whether to open the link in the browser or in the Teams external application. What is the mechanism behind that makes this possible? Does Teams register some sort of browser extension when installed on my PC? How can I invoke a random application from a browser and pass an URL to it?


Solution

  • The local application registers a custom URI scheme with the operating system. So instead of a URI with an https:// for Web browsing, the app might declare (upon installation) that it can open a x-custom-protocol:// scheme.

    The specifics of how a local app does this vary by platform (Windows, macOS, Android, iOS, etc.) but when the browser encounters 'x-custom-protocol://' that it suspects it can't handle, it offers to open in the external application.

    In the Teams case on Windows, when you install Teams it registers msteams:// as its URI scheme ("protocol handler" to some) and then when the browser encounters an msteams:// link, it asks if you want to hand it off to the installed Teams app.