Hello, I have my app published on google play and on the app store. When I’m on the website version and not in the actual app, I am able to copy text and elements to my clip board by using the Copy Air to Clipboard plugin. HOWEVER, when I go into my actual app, this doesn’t work and my clipboard remains empty. I have also tried to open the app in an external website via link (thinking that it the page might need chrome or a browser to copy to clipboard) but all it does is reload the app.
Can you please tell us what wrapper you have used to convert your Bubble app to a native app? Was it the Air Native wrapper or other? This is important as we cannot guarantee 100% compatibility with third-party wrappers, unfortunately.
function copyToClipboard() {
// Select the input element
const input = document.getElementById(‘copy’);
// Copy the input value to the clipboard
navigator.clipboard.writeText(input.value)
.then(() => {
// Copying to clipboard was successful
console.log(‘Text copied to clipboard’);
})
.catch((error) => {
// Copying to clipboard failed
console.error(‘Failed to copy text to clipboard:’, error);
});
}
I’ve tried it but I think I don’t get what to do…
Should I add an html element with this code?
Should I add a button with element ID “copyButton”?
Should I add the text with element ID “copy” to know what to copy?
Try installing the Toolbox plugin (Toolbox Plugin | Bubble). Then, add the action “Run javascript” in the workflow for copying to the clipboard. And add this code, replacing “url” with the text you want on the clipboard.
I used BDK wrapper I will check out the article that Eugene suggested on Stack Overflow. For the meantime I have created a mobile version of the page that displays the link as text that sits inside a red box. There are instructions underneath that instructs the user to 'long press the red box for 3 seconds and choose ‘copy’. If the link is inside an input it doesn’t copy the entire text when the user long presses. I had to put the link inside a text field instead.