2 * @class Roo.util.Clipboard
10 * Writes a string to the clipboard - using the Clipboard API if https, otherwise using text area.
11 * @param {String} text to copy to clipboard
13 write : function(text) {
14 // navigator clipboard api needs a secure context (https)
15 if (navigator.clipboard && window.isSecureContext) {
16 // navigator clipboard api method'
17 navigator.clipboard.writeText(text);
21 var ta = document.createElement("textarea");
23 // make the textarea out of viewport
24 ta.style.position = "fixed";
25 ta.style.left = "-999999px";
26 ta.style.top = "-999999px";
27 document.body.appendChild(ta);
30 document.execCommand('copy');