I remember how it all started. Long time ago, when dinosaurs were using modems, sites were called homepages and word google meant nothing, there still were URLs of the sites. We called it site addresses and if you wanted to look smartass you could say something like unique address of the web resource based in the world wide web. Programmers now known as it-specialists were programming on their own and it brought to the expected results — strange URLs of different pages. I mean something like blablabla.com/?sid=23l&pid=ln123&youare=cookiemonster which could lead somewhere to the search page or latest news from time to time. Then like the knights without fear and with goodness in hearts came new guys. Strange looking, doing nothing but consultations and calling themselves usabilists.

They marked the end of Programmers Orgy Era and somehow made dinosaurs disappear. It would be very strange if usabilists said nothing about URL’s, so they did. It was carved on stone and published in the books and on the internet: Thus it’s said: URL has to be readable and lead to the same page all the time, so s/he of users could understand and share it. It is wide known that thing published on the internet becomes true as soon as it is indexed by Google. So was this time. And people made URLs readable and understandable pointing to constant pages. It was even made for flash and ajax sites. URLs started looking this blablabla.com/products/media-and-socialising/you-ve-got-rickrolld.

Then all this social-networking started, so called web 2.0. Bunches of information made it not so comfy to worry about the URLs but they were still constant. Sharing came on the first place and developers and usabilists had to encourage people to copy link and paste it everywhere they could. That’s how that perfect buttons Copy URL of this page/video/porn/article to clipboard on different sites. Lack of technologies and standards made using flash the most usable way to copy some text to the clipboard. When users clicked the button the JavaScript dynamically embedded pre-made flash movie that copied to the clipboard the text send to it as parameter.

Due to liberal thoughts and no-ones awareness of what’s in clipboard this could possibly lead to the situation, when site could copy some junk in the clipboard even without user interaction. So Adobe decided to make things more fun and said: From now on (Flash version 10) if you people want to copy something to the clipboard, you’d have to interact with flash movie itself. Literally: user has to click on something in the movie to give movie access to the clipboard. It’s now user’s fault if he clicks the button and copies junk to the clipboard. Way to go, Adobe, way to go.

That brought series of problems with the way URLs were copied as I described earlier. Lucky for web developers akella came up with idea: we can make flash movie that would act like a button and supply pictures for different states as parameters. I helped him making that swf and it works.

Click on the button to copy text "/mega/ — schlong is schlonger" to the clipboard

And that’s the code if all files are in the same directory (also there is a tweak with ‘ instead of “ for flashvars value so you could insert html there):

  1. <object width="636" height="48">
  2. <param name="movie" value="copybtn.swf">
  3. <param name="flashvars" value='normal=btn0.png&pressed=btn2.png&hover=btn1.png&clipboard=<a href="/mega/">mega.genn.org</a> — schlong is schlonger' />
  4. <embed src="copybtn.swf" flashvars='normal=btn0.png&pressed=btn2.png&hover=btn1.png&clipboard=<a href="/mega/">mega.genn.org</a> — schlong is schlonger' width="636" height="48" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  5. </object>

David-m, commenting on akella’s technology said that it would be more convenient to make transparent flash movie that would copy text needed and place it on the top of any element. So I made the transparent version too. Nothing to look at — it’s transparent ;) downloadable here.