Wenn ein Button erstellt werden soll, der einen bestimmten Inhalt in die Zwischenablage kopieren soll, gibt es folgende Möglichkeiten:
Ein Beispiel für ein Eingabefeld:
<!DOCTYPE html><body>
<textarea id="outputArea" rows="10" cols="50"></textarea>
</body></html>
Ein Button hinzufügen und mit der Funktion copy_test verknüpfen:
<!DOCTYPE html><body>
<textarea id="outputArea" rows="10" cols="50"></textarea>
<button type="submit" onclick="myFunction()">Eingaben kopieren</button>
</body></html>

<!DOCTYPE html>
<html>
<body>
<script>
function myFunction() {
// Get the text field
var copyText = document.getElementById("eingabe");
// Select the text field
copyText.select();
copyText.setSelectionRange(0, 99999); // For mobile devices
// Copy the text inside the text field
navigator.clipboard.writeText(copyText.value);
// Alert the copied text
alert("folgender Text wurde kopiert: " + copyText.value);
}
</script>
<textarea id="eingabe" rows="10" cols="50"></textarea>
<button type="button" onclick="document.getElementById('eingabe').value = ''">Eingaben zurücksetzen</button>
<button type="button" onclick="myFunction()">Eingaben kopieren</button>
</body>
</html>
Dies funktioniert nur auf einer Webseite mit https://
Wenn ein SSL-Zertifikat aktiv ist kann durch eine .htacess eine automatische Weiterleitung dorthin eingerichtet werden:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]