desktopCapture

The desktopCapture API allows an extension to capture the content of the screen, individual windows, or specific tabs.

What it does

  • Enables an extension to request a media stream of the user's desktop.
  • The user is shown a picker dialog where they can choose what to share: their entire screen, a specific application window, or a browser tab.
  • The returned stream can be used with WebRTC or other web APIs to record, stream, or process the content.

When to use it

This permission is essential for extensions that provide screen recording or screen sharing capabilities.

Examples:

  • A screen recording tool for creating tutorials.
  • A "share to video conference" extension.
  • A remote support tool that allows a user to share their screen.

Manifest Declaration

{
  "name": "My Screen Recorder",
  "version": "1.0",
  "manifest_version": 3,
  "permissions": [
    "desktopCapture"
  ],
  "background": {
    "service_worker": "background.js"
  }
}

Security & Privacy

Why is it risky?

This permission allows an extension to record or share your screen. Anything visible on your screen—private documents, passwords, messages, bank account details—could be captured.

The main safety feature is that the extension cannot start capturing without your permission. Each time, it must show you a popup asking you to choose exactly what to share (your entire screen, one window, or one tab). However, the risk is that you might accidentally share more than you intend to. Always be very careful about what you are sharing and with whom.

API Usage Example

This example shows how to request a desktop capture stream when the user clicks the extension's action icon.

// background.js

chrome.action.onClicked.addListener(async (tab) => {
  chrome.desktopCapture.chooseDesktopMedia(
    ['screen', 'window', 'tab'],
    tab,
    (streamId, options) => {
      if (chrome.runtime.lastError) {
        console.error(chrome.runtime.lastError.message);
        return;
      }
      if (streamId) {
        console.log('Successfully received stream ID:', streamId);
        console.log('Options:', options);
        // The streamId must be passed to a context that has
        // navigator.mediaDevices (an offscreen document, popup, or
        // content script) and consumed there via getUserMedia:
        //   navigator.mediaDevices.getUserMedia({
        //     video: { mandatory: { chromeMediaSource: 'desktop',
        //                           chromeMediaSourceId: streamId } }
        //   });
        // Service workers cannot call getUserMedia directly.
      } else {
        console.log('User cancelled the capture request.');
      }
    }
  );
});

Extensions with the desktopCapture permission

Here are some popular browser extensions that use the "desktopCapture" permission. To explore more, try our Advanced search.

Permission Metrics

Popularity

Security Risk


Usage by Platform