DedrisFrameworkDedrisFramework

← Plugins  /  Clipboard

📋

Clipboard

cordova-clipboard
iOS Android 🌐 Browser

This small community plugin reads from and writes to the device's native clipboard. Use it to let users copy a code, link or token with one tap, or to paste content back into your app — the kind of polish people expect from a native experience.

Installation

terminal
cordova plugin add cordova-clipboard

API

The plugin is exposed as cordova.plugins.clipboard after deviceready:

MethodDescription
copy(text, success, error)Write a string to the clipboard.
paste(success, error)Read the current clipboard contents; success receives the text.
clear(success, error)Empty the clipboard (Android).

Usage example

Copy a referral code and confirm it landed on the clipboard:

www/js/app.js
function copyCode() {
  cordova.plugins.clipboard.copy(
    "DEDRIS-2026",
    function () {
      console.log("Copied to clipboard");
    },
    function () {
      console.error("Copy failed");
    }
  );
}

function readClipboard() {
  cordova.plugins.clipboard.paste(function (text) {
    console.log("Clipboard: " + text);
  });
}

Tips

📚 Source: the technical reference on this page is based on the cordova-clipboard project (MIT licensed), maintained by the open-source community and listed in Ionic Native. Descriptions and examples have been rewritten in DedrisFramework's own words. This plugin is not part of the Apache Cordova core.
← Back to plugins Start a project