Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
12030 Weergaven

I am using pyperclip.py to grab the content of a char field in just a button click and paste it anywhere, as that get copied to the clipboard. Its working perfect in the local system. While running it on server and access from client system through browser, it didn't get copied to the clipboard in client computer on button click. How can I make it copied to the clipboard of client system? please give a suggestion

Avatar
Annuleer
Beste antwoord

You need to implement your solution in the browser, not on python. Take here an example of how to copy to clipboard in js, you just need to find a way to integrate it on a widget

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Copy to Clipboard Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
function copyToClipboard(element) {
$(element).select();
document.execCommand("copy");
}
</script>
</head>

<body style="text-align:center">
<input id="t1" type="text"/>
<button onclick="copyToClipboard('#t1')">Copy</button>
</body>
</html>
 
Avatar
Annuleer
Auteur

Axel, thank you for your answer. I tried using javascript also at that time, but was unable to copy to the clipboard, let me try with one.