//-------------------------------------- //workaround document.featurePolicy.allowedFeatures(); const span = document.createelement('span') let text = document.body.innertext; span.textcontent = text span.style.whiteSpace = 'pre' // Put into the page document.body.appendchild(span) const selection = window.getselection() const range = window.document.createrange() selection.removeallranges() range.selectnode(span) selection.addrange(range) // Copy text to clipboard let success = false try { success = window.document.execcommand('copy') } catch (err) { console.log('error', err) } selection.removeallranges() window.document.body.removechild(span)