Guest User

Untitled

a guest
Dec 18th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. // Not all browsers support programmatic access to the clipboard (Firefox).
  2. if (aras.utils.isClipboardSupported())
  3. {
  4. copyToBuffer(buffer);
  5. return alert("Item(s) copied.");
  6. }
  7. else
  8. {
  9. // If clipboard access is not supported, print the result in an alert
  10. // and tell the user to copy contents with Ctrl+C.
  11. return alert("Browser does not allow clipboard access. Please use Ctrl+C to copy:\n\n" + buffer);
  12. }
  13.  
  14. // copyToBuffer function
  15. // takes a string & writes it to the clipboard
  16. function copyToBuffer(buffer) {
  17. if (window.clipboardData) {
  18. window.clipboardData.setData('Text', buffer);
  19. } else {
  20. aras.utils.setClipboardData('Text', buffer, window);
  21. }
  22. }
Add Comment
Please, Sign In to add comment