Github (Alexa: #348), Kickstarter (Alexa: #774), and many other major web-sites are increasingly using a flash-based button to facilitate one-click-copying of text, an otherwise disallowed action. Put aptly, by several stackoverflow-users, this method is 'overkill'. Basically a translucent flash applet is overlayed on a button-graphic to perform a clipboard-copying action, upon clicking the applet. Questionable security behavior is thus proxied to the flash applet, as the post-flash era draws near. Some browsers support document.execCommand('copy') ,which allows placing content, marked editable, into the Clipboard. However, the methodology dates back to the IE-5 era, which is more than a decade past, and execCommand is only loosely supported, yielding mixed results.
Jarek Milewski provides a better solution , which can be seen in action here.
By invoking a dialog-prompt as follows, window.prompt('Dialog text', refvariable); , a native-UI modal-input dialog is shown, with preselected text. The user is then offered the choice to click CTRL+C and hit ENTER.
Demo:
Click on the file-path below to copy and paste the selected text into the file-dialog below, thus allowing quick navigation to a specific file.
► Implementation #1 ( window -prompt):
c:\Windows\System32\restore\MachineGuid.txt
► Implementation #2 (preselected textbox):
c:\Windows\System32\restore\MachineGuid.txt
► Implementation #3 (direct textbox):
► Implementation #3 ( using an input -tag set to readonly; inspired by goo.gl ):
Conclusion:
Copying cannot be straightforward, as the Browser is obliged to uphold an encapsulated, sandboxed environment, with many security considerations at play. Prompting the user before performing a clipboard action, offers currently the best measure which is effective whilst less obtrusive than other methods. Given the increasing spreading of flash-based clipboard copying, the issue should not be neglected and alternative fully HTML5 / DOM compliant methods should be pursued.
About Me
- Lo Sauer
- Amateur photographer and professional programmer, inspired by scienceCircles I may fit:
- Science
- Nature
- Photography
- Software engineering/programming
- GPUs (Graphics Cards/Video games)
Popular Posts
-
Introduction: Recently a group named Anonymous Austria (twitter: AnonAustria) released a document containing almost 25.000 entries of polic...
-
Github ( Alexa: #348 ), Kickstarter ( Alexa: #774 ), and many other major web-sites are increasingly using a flash-based button to facilita...
-
The web-application is available here . It serves as a proof of concept, that without any Browser extension- or app- installations, tab-view...
-
Update: The KeyBoarder's project website is at http://lsauer.github.com/KeyBoarder . All resources of this site are freely licensed u...
-
CSS / HTML Design: To outline the keys in this document, the same css rules as wikipedia were applied, shown here with the help of synta...
-
High level programming without the power of regular expressions would be much less fun. They may often be crucial, when drafting a first pro...
-
" PublicHouse is a publicly queryable set of biological databases constructed using the BioWarehouse biological database warehousing ...
-
Currently, it is high season for password hacking. The victims LinkedIn , Last.fm and eHarmony , each have millions of users. Speculation ...
-
Internet security primarily involves aspects of browser security and network security. When generalized, Internet security applies to applic...
-
Introduction There are many web-services out there which provide small code snippets, to let you track your visitors to your site, and in t...
Blog Archive
-
▼
2012
(19)
-
▼
May
(9)
- JavaScript : Copy text to the clipboard, without F...
- CSS-3 for Physics Demos : radial and linear planew...
- Robust import / export of comma separated values o...
- Scalable web application development for metabolic...
- Sequence Viewer: FASTA to GFF - Interactively pret...
- Regular expressions for csv, comma separated value...
- Analysis, thoughts on Google Introducing the Knowl...
- Web development and Javascript tricks and tips - a...
- RegEx Text Import w. MySQL Query Browser - ad ETL ...
-
▼
May
(9)
Labels
- analysis (9)
- API (3)
- Blog (2)
- Browser (9)
- c# (1)
- chrome (1)
- css (2)
- css3 (3)
- data (6)
- Database (7)
- design (12)
- DOM (9)
- dynamic (3)
- Firefox (1)
- flatfile (2)
- google (7)
- Javascript (22)
- key (1)
- multitasking (2)
- offtopic (8)
- project (9)
- RegExp (6)
- Regular expressions (2)
- Release (2)
- science (3)
- security (4)
- SQL (2)
- statistics (2)
- UI (1)
- viz (8)
- webkit (2)
- workers (1)
CC-BY-SA 3.0. Powered by Blogger.
Wednesday, May 30, 2012
JavaScript : Copy text to the clipboard, without Flash and securely (Updated!)
Labels:
dynamic,
Javascript
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment