mega.genn.org

available in Russian, too!

Flash 10 Antipasti and URL roundup 19 comments

Sorry Mario

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 “http://mega.genn.org/ — 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="http://mega.genn.org/">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="http://mega.genn.org/">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.



Comments and trackbacks

18.04.09•15:29 cssing :: Архив :: Копировать в буфер

[...] 16. 18 апреля | mega.genn.org » Flash 10 Antipasti и жизнь URL [...]

18.04.09•23:31 Олег

Сказка занимательная, пробудила ностальгию. Только Москва не сразу строилась, и web-серверы не могли расчленить URL на часть, указывающую на существующую директорию, и на часть, указывающую на уточняющие параметры. Поэтому параметрам пришлось выглядить столь неестественно в естесвенном для человека мире интернета.
Было бы полезно добавить во флешку прозрачное отслеживание кликов через sendVars.

19.04.09•08:24 Genn

Олег, даже тогда можно было делать адреса news.php?day=6&month=4&year=1998 вместо news.php?sid=23sddsf…&date= 891820800. В первом примерер все понятно, а во втором присутствует стандартный для тех времен и зачастую никому не нужный session id (который можно и убрать из URL’а, запихнув в те же cookies) и дата в юниксовском формате времени.

Отслеживание для того, чтобы мы точно знали, скопировал ли пользователь адрес?

25.04.09•19:32 Олег

Нет сведений, что никто не додумался называть переменные так, как показано в первом примере. Session id добавлялся в URL интерпретатором языка автоматически, если было замечено, что через куки он не сохраняется.

Да. Для статистики, чтобы точно знать какие темы людям интересны, или какие тексты (куски кода) в действительности полезны.

25.04.09•19:32 Олег

“Notify me of followup comments via e-mail” не работает, а очень надеялся.)

25.04.09•21:09 Genn

Олег, сведений нет, но есть огромный опыт работы. Я, конечно, слегка преувеличиваю и ерничаю, но доля правды в моих словах все же есть, и немалая ;) Достаточно вспомнить весь тот ворох статей и заметок в конце 90-х о так коряво называемых «человеко-понятных урлах».

Для оповещения по почте отыщу другой скрипт. Спасибо за bug report. ;)

27.05.09•01:34 shinkareff

Код гиперлинка не копируется. Повтор двойных кавычек.
А ламерское счастье казалось таким близким …

27.05.09•08:22 Genn

shinkareff, спасибо за то, что нашли ошибку. Сейчас окончательно проснусь и все исправим ;) А что значит «повтор двойных кавычек»?

27.05.09•11:22 shinkareff

Не уверен, что здесь код отобразится, но попробую:

27.05.09•11:41 Genn

shinkareff, код не отобразился, но я уже прочитал комментарии и в CSSing. Проблема решается (я переделал пост так, чтобы ее и не возникало) просто — для передачи параметров используем flashvars и пишем их значение в знаках апострофа, чтобы не конфликтовало с тагами, которые мы копируем. Изменения отображены в коде представленном в посте ;)

15.06.09•13:13 JabbyPanda

BTW, такой же подход, как ты описал использует библиотека SWFUpload (v 2.2) для загрузки на сервер файлов с помощью Flash Player

http://demo.swfupload.org/v220/index.htm

Great minds think alike!

18.06.09•08:18 JabbyPanda

До речі, дарую ідею – назвати свій підхід як SWFClipboard (уже є SWFAddress, SWFUpload, SWFObject…) і активно пропагувати його в Інтернеті, адже чим більше користувачів, тим краще можна буде відточити свій код.

А от FlashClipboard називати свій підхід не вартує, юристи Adobe заставлять перейменувати ;)

20.06.09•12:26 Genn

JabbyPanda, дякую за iдею. SWFAddress я навiть користуюсь ;)

8.07.10•14:21 Alex

Всё вроде хорошо, но вот есть проблема!
Мне нужно чтоб кнопка скопировала [http://www.zippyshare.com/mediaplayer/mediaplayer.swf?file=http://www21.zippyshare.com/downloadMusic%3Fkey%3D29157749xx&volume=80&autostart=false&frontcolor=0×000000&backcolor=0xa63500&lightcolor=0xffffff&type=flv]

но копируется только [http://www.zippyshare.com/mediaplayer/mediaplayer.swf?file=http://www21.zippyshare.com/downloadMusic%3Fkey%3D29157749xx] – это.

Скрипт категорически отказывается копировать всё что находиться после символа &

Что делать?

8.07.10•23:54 Genn

Alex, замените &amp; на %23.

9.07.10•18:19 Alex

%23 = #
а мне именно необходим – &

10.07.10•08:35 Genn

Задумался о чем-то и написал не то ;) %38 — это как раз код амперсанда.

10.07.10•13:15 Alex

теперь копирует всё, но не заменяет %38 на & (((

2.10.11•12:49 Копировать строку в буфер обмена | Мой блог

[...] не получилось.  Немного погуглив, благодаря статье и статье удалось найти приемлемое решение, но уже с [...]

Share your thoughts

name and email are required

Post the comment

Latest tweets

Visit my other sites and accounts