# Any CLIPBOARD for WEB2

**URL:** <https://forum.xojo.com/t/any-clipboard-for-web2/74435>\
**Category:** Web\
**Created:** [February 9, 2023, 10:53pm UTC](https://forum.xojo.com/t/any-clipboard-for-web2/74435 "2023-02-09T22:53:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/u/Jose_Fernandez_del_Valle)\
**Post date:** [February 9, 2023, 10:53pm UTC](https://forum.xojo.com/t/any-clipboard-for-web2/74435/1 "2023-02-09T22:53:48Z")

</div>

Has anyone solved the problem of using an equivalent to the Clipboard object in Web2?

To be able to take values that are in the clipboard or send them to it using a web browser.

For example:

```auto
Var c As New Clipboard
c.Text = "The Quick Brown Fox outran the Lazy Dog"
c.Close

```

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [February 10, 2023, 12:00am UTC](https://forum.xojo.com/t/any-clipboard-for-web2/74435/2 "2023-02-10T00:00:38Z")

</div>

Isn’t that a security risk? Other than that, you would have to use the Web SDK and implement some javascript to read the clipboard and send it to your web app.

---

<div class="post-metadata">

**Author:** ![Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/u/Jose_Fernandez_del_Valle)\
**Post date:** [February 10, 2023, 12:09am UTC](https://forum.xojo.com/t/any-clipboard-for-web2/74435/3 "2023-02-10T00:09:49Z")

</div>

I want to get text out of the web page. It is not towards the system.

I only found a solution from Jeannot Muller (shared two years ago). But I want to know if there are any options.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [February 10, 2023, 1:00am UTC](https://forum.xojo.com/t/any-clipboard-for-web2/74435/4 "2023-02-10T01:00:10Z")

</div>

I’m not sure I understand. Do you want your web page (in the browser) to grab the contents of the clipboard, wherever they came from, and send it to your app? Or do you want the web page to grab the contents of the clipboard and stuff it in a text field on that page? Or do you want the user to highlight some text on the web page and send it to your app so you can act on it?

---

<div class="post-metadata">

**Author:** ![Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/u/Jose_Fernandez_del_Valle)\
**Post date:** [February 10, 2023, 1:53am UTC](https://forum.xojo.com/t/any-clipboard-for-web2/74435/5 "2023-02-10T01:53:04Z")

</div>

None of the mentioned options.

My system shows a grid with information (webListBox). I want the user to select a row and copy it to the clipboard.

---

<div class="post-metadata">

**Author:** ![Greg\_O](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o/32/22785_2.png) [@Greg\_O](https://forum.xojo.com/u/Greg_O)\
**Post date:** [February 10, 2023, 3:03am UTC](https://forum.xojo.com/t/any-clipboard-for-web2/74435/6 "2023-02-10T03:03:46Z")

</div>

Clipboard access in browsers is tricky at best. The problem is that it’s implemented to varying degrees in the different browsers, but also that it requires that the user actually press the keys and that the action of accessing the clipboard happen within that event loop. Not to mention that you have to override the behavior of CMD/CTRL C, V and X.

You can see a summary of the issues on this page:

> **["clipboard" | Can I use... Support tables for HTML5, CSS3, etc](https://caniuse.com/?search=clipboard)**
>
> "Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.

---

<div class="post-metadata">

**Author:** ![Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/u/Jose_Fernandez_del_Valle)\
**Post date:** [February 10, 2023, 4:22am UTC](https://forum.xojo.com/t/any-clipboard-for-web2/74435/7 "2023-02-10T04:22:52Z")

</div>

Thank you, Tim and Greg. I appreciate the responses received.

The only solution is the one shared by Jeannot Muller two years ago. Require a click-event to click on the button and copy the value to the user clipboard.

---

<div class="post-metadata">

**Author:** ![Eric\_Williams](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/ecccb3/32.png) [@Eric\_Williams](https://forum.xojo.com/u/Eric_Williams)\
**Post date:** [February 10, 2023, 4:28am UTC](https://forum.xojo.com/t/any-clipboard-for-web2/74435/8 "2023-02-10T04:28:50Z")

</div>

That’s what Greg is saying: for very good security reasons, the browser’s ability to place data on the user’s clipboard only operates when it is run in response to a user-initiated action (right-clicking and choosing an action from a popup menu, for example). It won’t work when triggered by your code alone.

---

<div class="post-metadata">

**Author:** ![Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@Jose\_Fernandez\_del\_Valle](https://forum.xojo.com/u/Jose_Fernandez_del_Valle)\
**Post date:** [February 10, 2023, 4:39am UTC](https://forum.xojo.com/t/any-clipboard-for-web2/74435/9 "2023-02-10T04:39:27Z")

</div>

I’ll give you the solution I found.

From this comment, I am very grateful to Jeannot Muller for sharing his problem and solution. It works fine.

There are times when the user requests something that this may not be able to do for security reasons. But it makes sense to ask for it to avoid the need to download all the information as an Excel file.

[https://xojo.jeannot-muller.com/teccclipboard-xojo-web-plugin-307688902422](https://xojo.jeannot-muller.com/teccclipboard-xojo-web-plugin-307688902422)
