скопировать текст в буфер обмена с веб-сайта - PullRequest
0 голосов
/ 20 июня 2020

Я пытаюсь создать сценарий TAMPERMONKEY, который копирует ie spicifi c строку определенного элемента в теле письма и помещает его в буфер обмена (готовый к вставке). Этот элемент находится в Gmail, и я не могу его изменить. Я использую tampermonkey. Пример: «ваш код 458855, пожалуйста, подтвердите ...» Я ПРОБИРАЛ НЕКОТОРЫЙ КОД, НО НИЧЕГО НЕ ПРОИСХОДИТ, ЭТО ТЕЛО

<table border="0" align="center" cellpadding="0" cellspacing="0" width="800px" style="border:1px solid #e9e9e9;font-family:Arial,Helvetica,sans-serif;font-size:12px"> <tbody><tr> <td bgcolor="#01325d" style="color:#ffffff;height:70px;width:800px" align="center">TEST REST</td> </tr> <tr> <td colspan="2" style="padding:20px"><p>hello,</p><p>your code is 458855 please confirme.</p><br><br><p>Merci.</p><p>thank,</p><p>do not repley</p><br><br><p></p><br><br><br></td> </tr> <tr> <td bgcolor="#01325d" style="text-align:center;color:#ffffff;height:70px;width:800px">Partenaires solutions</td> </tr></tbody></table>

var copyText = document.getElementById("ID");
  /* Select the text field */
  copyText.select();
  copyText.setSelectionRange(0, 99999); /*For mobile devices*/

  /* Copy the text inside the text field */
 // document.execCommand("copy");

  /* Alert the copied text */
  alert("Copied the text: " + copyText.value);
...