Simon Griffee · Time, light, movement & distance.

Copy to Clipboard

18 June 2013 · 1 minute read

This is great. No Flash, educates users, works in any GUI web browser.

Here is the full HTML & JavaScript code I used:

    <b>URL of this page</b> <small>(To copy: Click, <kbd>Ctrl/Cmd-C</kbd>, <kbd>Enter</kbd>)</small>
    <a href="" onclick="window.prompt('Press Ctrl+C (Cmd+C for Mac) and then Enter', text);" title="Click, press Ctrl+C and then Enter to copy to clipboard.">http://theurl.tld</a>

Which becomes:

URL of this page (To copy: Click, Ctrl/Cmd-C, Enter)