Skip to main content
Access the device clipboard from your web app using the Median JavaScript Bridge. You can write text to the clipboard and read the current clipboard contents.
Developer DemoTry it live: Load https://median.dev/clipboard/ in your Median app to test clipboard functionality during development.
The median.clipboard API exposes two methods: Both iOS and Android are supported. clipboard.get() supports two async patterns: Promises and named callback functions.

Implementation guide

Writing to the clipboard

Use median.clipboard.set() to copy a string to the system clipboard. This is the equivalent of a user pressing Ctrl+C / Cmd+C on their desktop browser.
Parameter Example use case: Providing a “Copy to clipboard” button for invite codes, promo codes, links, or other content.

Reading from the clipboard

Use median.clipboard.get() to retrieve the current clipboard contents. This method is asynchronous and returns a result object with either a data property (on success) or an error property (on failure). Choose the pattern that best fits your codebase: promises or callbacks. Promises integrate cleanly with async/await and modern JavaScript workflows.

Option 2: Named callback

Named callbacks are useful when integrating with legacy codebases or when you need the function to be callable from native app contexts. Pass the name of your callback function as a string using the callback key:
Response object Both clipboard.get() patterns return the same result object: Always check for result.data before using the value, and handle the result.error case.

Platform behavior

  • iOS: On iOS 14+, the system may display a notification banner informing the user that your app has accessed the clipboard. This is an OS-level behavior and cannot be suppressed.
  • Android: Clipboard read access may be restricted on Android 10+ when your app is not in the foreground. Ensure clipboard reads are triggered by an explicit user action.
Last modified on November 7, 2026