Copy to Clipboard
The Copy to Clipboard JS Bridge allows you to programmatically copy any text to the device clipboard using Twinr’s native bridge support.
JavaScript Function
Code
twinr_clipboard_set()
This function allows your webview or web app to copy custom text to the device's clipboard, which the user can then paste anywhere on their device.
Usage
JAVASCRIPT
twinr_clipboard_set("Text to be copied");
Example
JAVASCRIPT
twinr_clipboard_set("https://twinr.dev/invite-code");
In this example, the invite URL will be copied to the user’s clipboard when the function is called. You can trigger this function on a button click, form submission, or any custom logic.
Use Cases
- Copy promo codes, invite links, or referral IDs
- Simplify text sharing
- Allow users to quickly copy support contact info, FAQs, etc.