The HTML5 Clipboard API enables web applications to interact with the host clipboard.
Questions tagged [html5-clipboard-api]
17 questions
13
votes
2 answers
Jekyll Code snippet copy-to-clipboard button
The Problem
I am building a Jekyll site with the minima theme to publish some tutorial online. The tutorial pages contain many code snippets, for example:
```javascript
/* Global scope: this code is executed once */
const redis =…

Adam Matan
- 128,757
- 147
- 397
- 562
4
votes
3 answers
How to fix the "Cannot find name 'ClipboardItem'" error?
Getting the error
error TS2304: Cannot find name 'ClipboardItem'
when trying to create a ClipboardItem for navigator.clipboard.write().
const clipboardItemInput = new ClipboardItem({'image/png' : blobInput});
await…

sadasmita biswal
- 41
- 1
- 2
3
votes
1 answer
Clipboard API used in conjunction with Axios in click event
TL;DR
Is it possible to get the Clipboard API to write text from the result of an Axios get request in Safari even when the writeText() is a direct result of a user event?
Long version
I have an async button click event and inside of that click…

evans863
- 63
- 4
2
votes
0 answers
JS: Can't use asynchronous clipboard API for pages that will be minimized or put in the background
Example:
If the user has a different application or browser window/tab…

James Ronald
- 685
- 1
- 6
- 13
1
vote
0 answers
Copy Canvas content to clipboard in Javascript in iOS
Trying to copy a Canvas content to the Clipboard within a button click event handler
canvas.toBlob(
blob => { navigator.clipboard.write([new ClipboardItem({'image/png': blob})]) }
)
works well on Chrome Desktop but on iOs (tested on iPad) it…

Fabio Fidanza
- 11
- 1
1
vote
0 answers
Clipboard API copy to clipboard and then open new window? Avoid loosing window focus
Is it possible to open a new browser tab after content has been copied into the clipboard?
Currently I'm getting Uncaught (in promise) DOMException: Document is not focused. which I take it that I can't open a new window within the function as I…

Markus
- 458
- 4
- 16
1
vote
1 answer
How create link with text and paste it to telegram desktop
Im trying create "copy" button for using clipboard in different apps.
I'm expect that:
ctrl+v in simple text editor will create plain text
ctrl+v in RTF (or in app with "link" support) will create link
Here is a simplified code example:
const…

Kirill
- 161
- 2
- 15
1
vote
0 answers
dispatching ClipboardEvent on textarea element does not work
I wont to simulate paste event trough javascript as shown on snipped below
1
vote
0 answers
Using the clipboard API from a Google Apps Script Web Application
I have a simple Web-application (written in Google Apps Script using the HtmlService)
When a user clicks a button, it used to "paste" whatever text is on the clipboard to an input field. That worked fine until some Chrome-version (I guess it was…

Jasper Cuvelier
- 503
- 6
- 14
1
vote
1 answer
Event listener 'Copy' doesn't work with "Copy Link Address"
I want to modify the clipboard so that it becomes the regex match. And that works - as long as I use Ctrl+C or just "Copy". If I click on "Copy link address" (or "Copy link location"), the event listener doesn't seem to see the copied thing at all.…

retiredgoblin
- 21
- 6
1
vote
1 answer
How do I prompt user for clipboard read permission in the popup of the chrome extension?
I am building out my first Google Chrome Extension and want to create something that can read and write to the system clipboard.
I am currently putting all the js in a script imported by the popup.html for the extension.
I also have permissions…

srac1777
- 11
- 2
0
votes
0 answers
How can I use writeText() and readText() to copy and paste text throughout browsers using my Chrome Extension?
Im trying to create a Chrome extension that's main purpose is to copy and paste text, without using the standard ctrl C and V. Im trying to use writeText() to copy the text into my clipboard which works for the most part. But the issue lies when I…

yusufmidou
- 1
- 1
0
votes
0 answers
Need help in this code Disable printscreen in Angular 14
My exact requirement is I want to disable the printscreen option for the user.
I found one of the solution to disabling the printscreen.But some methods are
deprecated and looking for the working solution.
Here is the working solution…

KKR
- 1
- 1
0
votes
1 answer
How to Integrate Copy to Clipboard with Rainbow Syntax Highlighter
I am trying to integrate a basic, "copy to clipboard" function with Rainbow syntax highlighting library. Each code snippet on the page receives highlighting and can be copied to the clipboard by clicking a "Copy" button. Copy buttons are a common…

jottin
- 241
- 1
- 9
0
votes
0 answers
Add correct fallback for copy to Clipboard API in React app
I am using React 17 and building a Copy to clipboard functionality:
I have some state:
const [isCopied, setIsCopied] = useState(false);
Then the functions:
const copyTextToClipboard = async (text: string) => {
if…

meez
- 3,783
- 5
- 37
- 91