Copy link to clipboard
Copied
How do I use something like
document.getElementByName();
using javascript.
I get an error in the Javascript console on Safari
TypeError: undefined is not an object
Got it. Load it up to server. Doesn't work on local envirenment.
Copy link to clipboard
Copied
use document.getElemtnById()
Copy link to clipboard
Copied
Here's the code I cannot get to work.
This is in the javascript file Animate produces with Canvas.
function copyStringToClipboard (str) {
const el = document.createElement('textarea');
el.value = str;
document.body.appendChild(el);
el.select();
el.setSelectionRange(0,999999999999);
document.execCommand('copy');
document.body.removeChild(el);
}
Copy link to clipboard
Copied
use naviagator.clipboard.writeText()
Copy link to clipboard
Copied
Google Chrome javascript console says,
Uncaught (in promise) DOMException: Document is not focused.
Looks as if there is a security update in browsers to prevent dynamically writing to the clipboard.
Copy link to clipboard
Copied
i don't see an error in chrome.
is that function on the main timeline and called from the main timeline?
Copy link to clipboard
Copied
This is on the main timeline. This function used to work but a few months ago stopped working. I am working on a workaround ( javascript alert or downloadable text file should work for my purposes ).
Copy link to clipboard
Copied
i don't see that error.
did you install a browser plugin after the problem started?
Copy link to clipboard
Copied
It could be a dom_underlay_container I added to the HTML. Also has an iframe associated with it. I am just going ahead with my workaround.
Copy link to clipboard
Copied
ok