Test the clipboardchange event—a more efficient way to monitor the clipboard

Rohan Raja
Rohan Raja
Patrick Brosset
Patrick Brosset

Published: September 23, 2025

The clipboardchange event is a new feature added to Chrome by the Microsoft Edge team. It lets you efficiently monitor clipboard changes without the performance overhead of polling.

You can now test the clipboardchange event with an origin trial in both Chrome and Edge, starting with version 140. We welcome any feedback you might have while testing this new feature as we ultimately hope to standardize it.

The challenges of polling the clipboard to detect changes

To know what content is available in the system clipboard, you have to use inefficient polling methods. For example, text editing web apps might want to enable different "Paste" buttons based on whether the clipboard contains text, an image, or HTML content.

The current approach to achieve this requires you to repeatedly call the navigator.clipboard.read() method to check the clipboard contents, as shown by the following code snippet:

// Inefficient polling approach
setInterval(async () => {
  try {
    const clipboardItems = await navigator.clipboard.read();
    updatePasteButtons(clipboardItems);
  } catch (err) {
    console.error('Failed to read clipboard:', err);
  }
}, 1000); // Poll every second

While this works, it also comes with significant drawbacks.

Performance impact

Constantly polling the clipboard creates unnecessary overhead. Each call to navigator.clipboard.read() requires system-level clipboard access, which can negatively impact the performance of your application, especially on resource-constrained devices. The polling frequency becomes a trade-off between responsiveness and performance.

Battery drain

On mobile devices, frequent clipboard polling can contribute to battery drain as the application continuously accesses system resources even when the user isn't actively copying or pasting content.

User experience inconsistencies

The polling interval creates delays between the time content is copied and when the UI updates to reflect the new clipboard state. Users might see outdated paste button states or experience brief periods where the correct options aren't available.

Privacy concerns with over-polling

Frequent clipboard access can raise privacy concerns, as applications are continuously reading clipboard data even when it hasn't changed. This can feel intrusive to users who are privacy-conscious about their clipboard contents.

The clipboardchange event

To address these challenges, we've implemented a new event called clipboardchange, and are launching an origin trial in both Edge and Chrome, so you can test it in your apps.

This event lets web applications reactively respond to clipboard changes rather than proactively polling for them. It fires automatically when content is copied or cut to the clipboard from any application, the clipboard is cleared, or content is pasted (which may clear the clipboard in some cases). The event only fires when the document has focus.

You can listen to the clipboardchange event by adding a listener on the navigator.clipboard interface as shown here:

navigator.clipboard.addEventListener('clipboardchange', event => {
  console.log('Clipboard content changed!');
  console.log('Available MIME types:', event.types);

  // Update UI based on available formats
  updatePasteButtons(event.types);
});

Key advantages

The clipboardchange event provides several benefits over polling:

  • Efficient: Events are only fired when changes actually occur.
  • Privacy-preserving: The event only exposes native MIME types, not actual content.
  • No permission prompts: Since no sensitive data is exposed, no user permission is required.
  • Real-time responsiveness: The UI updates immediately when the content in the clipboard changes.
  • Focus-aware: Events only fire when the document has focus.

The types property

The clipboardchange event object includes a types property, which contains an array of MIME types that are available in the clipboard:

navigator.clipboard.addEventListener('clipboardchange', event => {
  // Example types array: ['text/plain', 'text/html', 'image/png']
  const hasText = event.types.includes('text/plain');
  const hasImage = event.types.includes('image/png');
  const hasHtml = event.types.includes('text/html');

  // Enable/disable paste buttons accordingly
  document.getElementById('paste-text').disabled = !hasText;
  document.getElementById('paste-image').disabled = !hasImage;
  document.getElementById('paste-html').disabled = !hasHtml;
});

Focus behavior

If clipboard changes occur while the document is not in focus, a single clipboardchange event is fired when the document regains system focus. Historical clipboard change information won't be available, only the available types when the page gained focus will be included in the types member.

Test the clipboardchange event today

You can test the new clipboardchange event today:

  • Either locally, by enabling the feature in your browser only.
  • Or on your production web application, by registering for the origin trial.

Detect the clipboardchange event for better compatibility

First, since this is a new feature, you'll need to detect its support before using it. You can achieve this by testing the existence of the onclipboardchange property on navigator.clipboard, as shown here:

if ('onclipboardchange' in navigator.clipboard) {
  // The clipboardchange event is supported
  navigator.clipboard.addEventListener('clipboardchange', handleClipboardChange);
} else {
  // Fallback to polling or other methods
  console.log('clipboardchange event not supported, using fallback');
  setInterval(checkClipboard, 2000);
}

Test locally

To test the clipboardchange event in your browser only:

  1. Open the about://flags page.
  2. Search for ClipboardChangeEvent in the Search flags box.
  3. Use the drop-down and change the value from Default to Enabled.
  4. Restart your browser.

Sign up for the origin trial

To try the clipboardchange event on your site with real users, sign up for the origin trial in Chrome or Edge. The origin trial will run in Chrome and Edge between versions 140 and 142 (between September 2, 2025, and December 2, 2025).

Read Get started with origin trials to learn more about origin trials, and how to get started

Demo

To see the event in action, explore our demo and check out the source code on GitHub.

This demo shows how the clipboardchange event can be used to create a responsive paste interface that automatically updates based on your clipboard contents.

Try copying different types of content (text, images, HTML) and watch how the paste buttons enable and disable in real-time without any polling!

Feedback

We would love to hear from you about how the clipboardchange event works for your use cases. Provide feedback by creating an issue at the W3C/clipboard-apis repository.
Public signals about your interest will help us, and other browsers, understand the importance of this feature for you, which can inform the standardization process.

Even if this event can be used as a progressive enhancement, we want to standardize it as part of the Clipboard API specification, and eventually see it adopted by all browsers. For now, you can fall back to polling or other clipboard monitoring techniques.

Learn more