5 ms·
It's to enable click-to-copy (to the clipboard.)
by pistoriusp 17y ago
It's to enable click-to-copy (to the clipboard.)
- RyanMcGreal 17y agoI'm not going to pretend that HTML5+Javascript can easily replication Flash functionality, but I'm pretty sure it can handle copy-to-clipboard. Edit forehead slap. The last time I had to write a script to copy to clipboard was several years ago and I was targeting the script for IE on a company intranet. I stand humbly (and foolishly) corrected.
- kylebragger 17y agoHm, that would be great — I'd love to see an example of this.
- warfangle 17y agoTypically you'll get a selection object, get the range object, and .execCommand("Copy") on it. Unfortunately it only really works in IE (afaik); it used to work in FF if you got the Allow Clipboard Access plugin, but even that's been disabled. It could potentially be a huge security risk, which is why it's had to be sandboxed into plugins like flash.
- zmmmmm 17y ago>It could potentially be a huge security risk, Why is copying data into the clipboard a security risk? > which is why it's had to be sandboxed into plugins like flash. But it's already in a sandbox (the browser). Why do we need a sandbox inside the sandbox? I really don't understand what the huge deal is with this. It's almost harder to get some plain text onto the clipboard than it is to get the user to run a .exe.
- piranha 17y agoIt can't as long as I know. :(
- edd 17y agoA slightly better implementation would have been to have a JavaScript click event on every colour and then use a JavaScript to Flash function to do the copy to clipboard. Then only one Flash file would have had to be loaded.
- slig 17y agoAFAIK, it wouldn't work. Flash can only copy to the clipboard after an event like click, doubleclick, etc, within the swf.
- weaksauce 17y agoHe is saying that when you click on the color it sends a message to the flash object as to which color they are interested in and then the popup will be eligible to click on which will then copy to the clipboard.
- schapman623 17y agoBecause Flash objects are positioned above every other element on the page, I'd have to guess which color is below the large, single Flash object. I tried doing this with variable levels of success, but concluded that having a Flash object for every color didn't have any huge downside. Performance seems to be acceptable, unless you're using IE. Let me know if you have any performance issues.
- godDLL 17y agoThe page takes a couple of seconds to refresh on a 2007 Mac Mini. Take a look here, this piece of code provides `copy("text");` in JavaScript, and uses only one SWF (I think). sites.google.com/site/yangshuai10/jquerycopyplugin
- invisible 17y agohttp://sites.google.com/site/yangshuai10/jquerycopyplugin http://sites.google.com/site/yangshuai10/jquerycopyplugin (just linking)