# Copy to clipboard on client in Node-Red dashboard

**URL:** <https://discourse.nodered.org/t/copy-to-clipboard-on-client-in-node-red-dashboard/21306>\
**Category:** Dashboard\
**Created:** [5 February 2020 13:03 UTC](https://discourse.nodered.org/t/copy-to-clipboard-on-client-in-node-red-dashboard/21306 "2020-02-05T13:03:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dalbyte](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dalbyte/32/14680_2.png) [@Dalbyte](https://discourse.nodered.org/u/Dalbyte)\
**Post date:** [5 February 2020 13:03 UTC](https://discourse.nodered.org/t/copy-to-clipboard-on-client-in-node-red-dashboard/21306/1 "2020-02-05T13:03:45Z")

</div>

#Copy string to Clipboard on client  
I'm trying to build a button that automatically saves a dashboard string to the the clipboard of the client.  
That means that the client with an open dashboard should be able, to get the string into his clippoard indipendent of running node-red on his device.

My problem is that all my solutions only write to the clipboard of the device where node-red is running.

 ![ineedhelp](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c482e5a2d255f60049c22efded10a99d4404ae28.png)

# What I tried:

## 01 node-red-contrib-clipboard

Unfortunately, just writes from host and client to my Windows PC where node-red is running.

## 02 npm module clipboardy

Unfortunately, just writes from host and client to my Windows PC where node-red is running.

```javascript
const clipboardy = global.get('clipModule');
let id = msg.payload.title.replace('<b>', '').replace('</b>', '');
 
clipboardy.writeSync(id);
 
return msg;

```

## 03 html template

```auto
msg.payload = '<script>navigator.clipboard.writeText("' + msg.payload +'")</script>';

```

Unfortunately, just writes from host to my Windows PC where node-red is running.

Does anybody have a solution to this problem?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [5 February 2020 13:23 UTC](https://discourse.nodered.org/t/copy-to-clipboard-on-client-in-node-red-dashboard/21306/2 "2020-02-05T13:23:09Z")

</div>

If you want to copy to the clipboard of the device running the browser that is viewing the dashboard, then you need some code in the ui\_template node to do it. This isn't something you can do from the runtime side at all.

There are lots of guides for how to copy text to the clipboard from a webpage - for example: [https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f](https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 March 2020 13:23 UTC](https://discourse.nodered.org/t/copy-to-clipboard-on-client-in-node-red-dashboard/21306/3 "2020-03-06T13:23:21Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
