Handle missing "navigator.clipboard" - #159
Conversation
In some cases navigator.clipboard can be undefined. For example on HTTP site (happens in DMZ environments). In such cases copy will fail. However, it can always be remediated on user side by using good old execCommand. This commit modifies code to avoid exception on copy.
CarlosNZ
left a comment
There was a problem hiding this comment.
Thanks for this. I wonder if you know an easy way to create an environment where navigator.clipboard is not defined?
|
You can create a record in /etc/hosts (mac, linux) to point to your localhost and then open it with port and HTTP. I think windows has something similar. |
Okay, thanks. I managed to test it out and I can reproduce the issue and see your solution! I wonder though -- with your solution, I still get the If so, what function are you using? |
|
yeah, my solution is to run copy code inside |
Thanks for the info. Apparently the I'll merge your PR though and I'll start a new issue to:
Appreciate the contribution! |
In some cases navigator.clipboard can be undefined. For example on HTTP site (happens in DMZ environments).
In such cases copy will fail. However, it can always be remediated on user side by using good old execCommand.
This commit modifies code to avoid exception on copy.