Questions tagged [html5-clipboard-api]

The HTML5 Clipboard API enables web applications to interact with the host clipboard.

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…
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…
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