clipboard.html 531 B

12345678910111213141516171819
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>Clipboard API helper page</title>
  6. <script>
  7. function tryClipboardReadText() {
  8. navigator.clipboard.readText()
  9. .then(() => document.title = 'success')
  10. .catch(() => document.title = 'fail');
  11. }
  12. function tryClipboardWriteText() {
  13. navigator.clipboard.writeText('test')
  14. .then(() => document.title = 'success')
  15. .catch(() => document.title = 'fail');
  16. }
  17. </script>
  18. </head>
  19. </html>