DEV Community

Discussion on: How to copy text to the clipboard with Javascript

Collapse
 
sincapshop profile image
Sincap Shop

Method 2: Clipboard API
How can I integrate it into my chrome extension because it doesn't work in the extension while it works in the normal browser.

Let me put it this way, I print a part of the source of a web page to my plugin and I want it to copy when a button is clicked.

Collapse
 
tqbit profile image
tq-bit

I think chrome extensions run in their own sandbox environment. Instead of requesting permission in the browser, you need to 'proxy' them towards the env plugins run within.

There's this section in the docs describing how to do so, I hope it'll help you: developer.chrome.com/docs/extensio...

Some comments have been hidden by the post's author - find out more