add auto copy support
This commit is contained in:
parent
7cc4b410dc
commit
1078e3d3e0
2 changed files with 4 additions and 18 deletions
|
@ -76,8 +76,6 @@ func uploadHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
// Setzen der Content Security Policy
|
||||
//w.Header().Set("Content-Security-Policy", "default-src 'self'; script-src 'self'; object-src 'none';")
|
||||
//w.Header().Set("Content-Security-Policy", fmt.Sprintf("default-src 'self'; script-src 'self' 'nonce-%s'; object-src 'none';", nonce))
|
||||
w.Header().Set("Content-Security-Policy", fmt.Sprintf("script-src 'self' 'nonce-%s';", nonce))
|
||||
|
||||
mu.Lock()
|
||||
|
|
|
@ -15,21 +15,9 @@
|
|||
|
||||
<script src="/static/js/script.js" nonce="{{.Nonce}}"></script>
|
||||
|
||||
<!-- <script type="text/javascript" nonce="{{.Nonce}}">
|
||||
function kopiereURL() {
|
||||
// Finde das Textfeld mit der URL
|
||||
var copyText = document.getElementById("imageURL");
|
||||
// Wähle den Text innerhalb des Textfeldes
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999); // Für mobile Geräte
|
||||
|
||||
// Versuche, den Text ins Clipboard zu kopieren
|
||||
navigator.clipboard.writeText(copyText.value).then(function() {
|
||||
console.log('Kopieren in die Zwischenablage erfolgreich.');
|
||||
}, function(err) {
|
||||
console.error('Fehler beim Kopieren in die Zwischenablage: ', err);
|
||||
});
|
||||
}
|
||||
</script> -->
|
||||
<script nonce="{{.Nonce}}">
|
||||
// Rufen Sie hier Ihre Funktion auf
|
||||
kopiereURL();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue