This is how you can copy anything, to a user’s clipboard, even in a website or webapp. This is all with the power of Ruby! :D
I’m going to be using Sinatra for this example, to make it as easy as possible!
This is uses an awesome gem called Clipboard! You’re going to have install it first.
Here’s the app:
require 'clipboard' require 'sinatra' get '/' do "Hello there." end get '/copy' do Clipboard.copy("This is a sentence that has been copied to your clipboard") "Copied some text to your clipboard! CTRL + P it!" end
And that’s it! Atleast for a basic app. Feel free to tweet at me, and let me know what you think there!