diff --git a/interface/options/options.js b/interface/options/options.js index eb1af45..e05378b 100644 --- a/interface/options/options.js +++ b/interface/options/options.js @@ -199,15 +199,7 @@ document.addEventListener('DOMContentLoaded', async (event) => { * @param {string} text Text to copy. */ function copyText(text) { - const fakeText = document.createElement('textarea'); - fakeText.classList.add('clipboardCopier'); - fakeText.textContent = text; - document.body.appendChild(fakeText); - fakeText.focus(); - fakeText.select(); - // TODO: switch to clipboard API. - document.execCommand('Copy'); - document.body.removeChild(fakeText); + navigator.clipboard.writeText(text); } /** diff --git a/interface/popup/cookie-list.js b/interface/popup/cookie-list.js index a1335d3..f8c4b1f 100644 --- a/interface/popup/cookie-list.js +++ b/interface/popup/cookie-list.js @@ -1202,15 +1202,7 @@ import { CookieHandlerPopup } from './cookieHandlerPopup.js'; * @param {string} text Text to copy. */ function copyText(text) { - const fakeText = document.createElement('textarea'); - fakeText.classList.add('clipboardCopier'); - fakeText.textContent = text; - document.body.appendChild(fakeText); - fakeText.focus(); - fakeText.select(); - // TODO: switch to clipboard API. - document.execCommand('Copy'); - document.body.removeChild(fakeText); + navigator.clipboard.writeText(text); } /**