I try again: to get the clipboard content I use
field = document.activeElement;
var area = document.getElementById(“fcb_txt_area”);
if (area) {
area.setAttribute(“style”, “visibility:visible;”);}
else {
area = document.createElement(“textarea”);
area.setAttribute(“id”, “fcb_txt_area”);
area.setAttribute(“cols”, “1”);
area.setAttribute(“rows”, “1”);
if (field) {
field.parentNode.append(area);
}
else {
document.body.appendChild(area);
}
area.contentEditable = true;
}
area.textContent = ‘’;
area.select();
document.execCommand(“paste”);
area.setAttribute(“style”, “visibility:hidden;”);
return area.value
Well, this works, kind of, but if the textarea is created in the bottom of the page, the browser “is moving down” possibly because of area.select. If the
document.activeElement is defined (usually a form field), this element is pushed somewhat on the left when the textarea is appended.
In Opera or Chrome, this code would run from the background and nothing would change on the page.
Any idea on how to minimize these page hiccups ?
Thanks
F.