How can I add a Copy Button?

I’m wondering if a JavaScript solution would work with the webviewer.



<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://thunkable.github.io/webviewer-extension/thunkableWebviewerExtension.js" type="text/javascript"></script>
  </head>
  <body>
  <script type="text/javascript">
 function copyToClipboard(value) {
  var tempInput = document.createElement("textarea");
  tempInput.value = value;
  document.body.appendChild(tempInput);
  tempInput.select();
  document.execCommand("copy");
  document.body.removeChild(tempInput);
} 

ThunkableWebviewerExtension.receiveMessage(function(message) {
copyToClipboard(message)
});
  </script>
</html>

https://x.thunkable.com/copy/00c79b0c245b1c0101476aceac42981e

this does in fact work!

the only blocks needed

@darren this would be a cool addition to sendth.at perhaps?!

8 Likes