Clipboard
You may save text to your device clipboard and retrieve the current clipboard contents via the Median JavaScript Bridge.
Developer Demo
Display our demo page in your app to test during development https://median.dev/clipboard/
Save to Clipboard
↔️Median JavaScript Bridge
Run the following Median JavaScript Bridge command to save text to the device clipboard:
median.clipboard.set({"data": "Save to Clipboard"});
Retrieve from Clipboard
↔️Median JavaScript Bridge
Run the following Median JavaScript Bridge command to retrieve the latest item from the device clipboard using a promise:
median.clipboard.get().then(function (result){ if (result.data) { alert('Received Clipboard item: ', result.data); } else { // error receiving clipboard item alert(result.error); } });
Or using a callback function:
median.clipboard.get({"callback": "clipboardCallback"}); function clipboardCallback(result) { if (result.data) { alert('Received Clipboard item: ', result.data); } else { // error receiving clipboard item alert(result.error); } }
Updated 9 months ago
Next Steps