Copy to clipboard function

asked 2021-10-20 07:18:56 +0800

daniapesteguia gravatar image daniapesteguia
7 2

Hi, I'm having trouble creating a copy to clipboard function, none of the sugestions of ZK around seem to work properly.

I'm trying to copy an url I have on @load(each.url) with a Button but I don't know how should I start. ┬┐Anyone did this before?

delete flag offensive retag edit

1 Answer

Sort by ┬╗ oldest newest most voted

answered 2021-10-20 10:09:41 +0800

cor3000 gravatar image cor3000
6270 2 7
ZK Team

yes clipboard can be troublesome since it depends on the user's permission and the page context (https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText)

Here an example which doesn't work in an iframe on my side: https://zkfiddle.org/sample/3qfoq97/1-copy-to-clipboard

But works when opened in a dedicated browser tab: https://temp.zkfiddle.org:8080/t9601/3qfoq97/1/

So as you see existing example may be correct just don't working due to denied permissions. Basically if you need help in this forum, it's best to provide some kind of 3rd party example that works, just showing it's possible in the browser. Then we can often help integrating this same functionality from inside a ZK application. vice-versa: something that doesn't work in a browser in general, alos won't work in ZK.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2021-10-20 07:18:56 +0800

Seen: 7 times

Last updated: Oct 20

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More